CHARINDEX start position finds the next delimiter. Guard a missing first match, preserve NULL, and extract empty fields without negative lengths.
Using Synonyms to Simplify Cross-Database Queries
Using synonyms can hide a cross-database object name from callers, but permissions, dependency checks, and deployment still need care.
Drawing a Diagram of an Existing Database
A diagram of an existing database starts with real foreign keys, uses SSMS to reveal relationships, and records the important paths a picture misses.
EOMONTH: Month Ends Are Different From DATEADD Month Clipping
EOMONTH gives me a month-end date when that is the actual reporting requirement. DATEADD moves a date by a month. These operations can agree for one step and disagree on the next.
SQL SERVER – Identifiers As Valid Object Names
Chi-Ho Min found you can skip parts of a four part name with dots, like servername…tablename. Here is how identifiers work as valid object names.
SQL SERVER – Generate Foreign Key Scripts For Database
Madhaiyan Seenivasan’s stored procedure lets you generate foreign key scripts for a whole database, handy when you drop all foreign keys and add them back.
SQL SERVER – 2008 – Row Constructors – Load Temp Tables From Stored Procedures
Load temp tables from stored procedures with a simple INSERT INTO EXEC instead of a loopback OPENQUERY. Here is the before and after code.







