MySQL has no ROW_NUMBER() function like SQL Server. Here are two methods for generating row number values for each row with a variable in a SELECT statement.
SQL SERVER – Retrieve Maximum Length of Object Name with sp_server_info
How long can a table name be in SQL Server? The answer is 128, and you can confirm it yourself by running the stored procedure sp_server_info.
Sending an HTML Table by Email With sp_send_dbmail
Turn a wall of report text into a clean table. FOR XML PATH escapes your data, and a few small tricks handle NULL values and empty days.
The Outbox Table: Publishing Changes Reliably From a Transaction
Orders commit and the message vanishes? Save both in one transaction, then let a worker claim, send and retry with a lease. Duplicates are still possible.
Storing Images in varbinary(max): Size, Reads and Backups
Store images in varbinary(max), read file bytes with OPENROWSET, inspect LOB allocation, and evaluate backup and retrieval costs.
SQL SERVER – Listing Primary Key of Table with Stored Procedure sp_pkeys
Here is how to list the primary key of a table with the stored procedure sp_pkeys, a follow up to my earlier post on sp_fkeys.
SQL SERVER – Listing Foreign Key Relationships of Table with Stored Procedure sp_fkeys
A quick trick to list all the foreign key relationships of a table with the stored procedure sp_fkeys, with a sample script on AdventureWorks2012.






