Miscellaneous

Technical Article

SQL 2K SMTP mail on Windows 2K

  • Script

SP_SQLSMTPMail is an OLE automation implementation of the CDOSYS dll for Windows 2000 which utilizes a network SMTP server rather than an Exchange server/Outlook client. The stored procedure functions similar to xp_sendmail including the ability to run a query and attach the results. No MAPI profile is required. It is also a working, detailed example […]

5 (6)

You rated this post out of 5. Change rating

2005-10-12 (first published: )

3,764 reads

Technical Article

Find and replace column constraints

  • Script

I submit this script as an example of how one might go about generating 'Alter Table' statements that find and replace specific column constraints. In my case I had to find all occurrences in a production db of suser_name() as a column constraint and replace it with suser_sname(). This script is only an example and […]

You rated this post out of 5. Change rating

2002-10-08

247 reads

Technical Article

Change the probability of the pseudo-random values

  • Script

The usual practice, when we need some test data, is to employ the pseudo-random built-in function RAND(). We usually use it to produce a random value in some range and it produces these values with the same probabilities. Sometimes we need more "realistic" data when some values are more probable than others are. In this […]

5 (1)

You rated this post out of 5. Change rating

2002-10-04

264 reads

Technical Article

INSERTS that will STAY after a ROLLBACK is issued

  • Script

Sometimes it is usefull to log stuff in SQL server while stored procs are running. If a long stored proc runs you sometimes want to be able to log a message in a loggin file. But what if a rollback occurs.... The message is lost as well.Here is a method to set up a seperate […]

You rated this post out of 5. Change rating

2002-10-01

726 reads

Technical Article

Find the Nth Occurrence of a Character in a String

  • Script

T-SQL's CHARINDEX() function is a useful for parsing out characters within a string.  However, it only returns the first occurrence of a character.  Oftentimes one needs to locate the Nth instance of a character or a space, which can be a complicated task in standard T-SQL.  This function I wrote, imaginatively named CHARINDEX2(), allows one […]

4.64 (11)

You rated this post out of 5. Change rating

2002-09-27

31,521 reads

Technical Article

Random string and random number generators

  • Script

The first part will create 2 stored procedures with self-explanatory names. The second is a standalone SQL that may be used in any stored procedure, script or DTS package.The generated string does not have any spaces and include only lower-case letters. To include anything else just change the boundaries for ASCII codes in the script.The […]

1 (1)

You rated this post out of 5. Change rating

2002-09-26

549 reads

Technical Article

Grant permissions to a role

  • Script

A very simple script that will first create a role (if it does not exist yet) and then grant full permissions on tables, views and stored procedures to the newly created role. Of course, you can add any filtering (i.e. grant permissions only for tables beginning with "abc") or grant partial permissions (SELECT or DELETE […]

You rated this post out of 5. Change rating

2002-09-26

1,120 reads

Technical Article

GET COUNT(*) from 1 table

  • Script

IN a scenario where the user would like to retrieve the Count(*) from a table without any condition, in that case this query will workselect count(*) from 'Suppose product is the table,if the product table is light then its ok but if it contains a huge data, then this query can be used.select max(rowcnt) from […]

You rated this post out of 5. Change rating

2002-09-26

322 reads

Technical Article

Find circular references in single table

  • Script

The objective is to find circular references in a single table related to itself. The script deals with a sample table Skills that have a SkilGUID (primary key) field and a SkilParentGUID field which is a foreign key to the record's parent from the same table. The number of levels in the hierarchy is not […]

3.67 (3)

You rated this post out of 5. Change rating

2002-09-24

1,071 reads

Blogs

Master SQL Subqueries with This Free Course

By

Want to boost your SQL game? Check out this free course, SQL Subqueries: Real-World...

Using Flyway Prepare for State-Based Deployments

By

One of the neat enhancements made to Flyway was the addition of state-based workflows...

How I Migrated to Azure PostgreSQL Flex from Single Server

By

I did a couple of posts previously on dumping/restoring Azure PostgreSQL databases and also...

Read the latest Blogs

Forums

When trying to use a LocalDB, I get an error

By Doctor Who 2

I tried to find an appropriate forum to post the question. This one seems...

Resolving Access Denied Errors During SQL Server Database Attachment

By Noman072

Comments posted to this topic are about the item Resolving Access Denied Errors During...

The Lesser Used Functions

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The Lesser Used Functions

Visit the forum

Question of the Day

SQL in an Azure VM Backup

If I use the Azure Backup service for automated backups of my SQL Servers in Azure VMs, how often can I configure log backups? (as of Dec 2024)

See possible answers