Primary Key and Unique Key both enforce uniqueness, but they differ in the index they create and in NULL handling. Here are the differences and the scripts.
SQL SERVER – UDF – Function to Convert Text String to Title Case – Proper Case
My UDF udf_TitleCase converts any string to Title Case, also called Proper Case. The post has a sample call, its output and the full T-SQL code of the function.
SQL SERVER – ReIndexing Database Tables and Statistics with Targeted Maintenance
ReIndexing Database tables starts with a measured maintenance need. I check the workload before choosing an index operation.
SQL SERVER – Query to find number Rows, Columns, ByteSize for each table in the current database – Find Biggest Table in Database
A query to find the biggest table in database: it lists row count, column count and data size for each table using sp_spaceused, sorted by data size.
SQL SERVER – Simple Example of Cursor
The simple example of cursor I have used for years: declare it, open it, fetch each Account_ID in a WHILE loop, then close and deallocate the cursor.
SQL SERVER – Shrinking Truncate Log File – Log Full
The old code I used to truncate log file space with DBCC SHRINKFILE and BACKUP LOG WITH TRUNCATE_ONLY. It breaks the log chain, so take a full backup after.







