One query to find the First and Last Day of Current Month in SQL Server, plus the last day of the previous month and the first day of the next.
SQL SERVER – Explanation SQL Command GO
GO is not a T-SQL command. It tells SQL Server tools to send the current batch. Why a GO statement must sit on its own line, and how it ends a batch.
SQL SERVER – 2005/2000 Examples and Explanation for GOTO
How the GOTO statement jumps to a label in the same T-SQL batch. My explanation for GOTO covers the syntax, the rules and when I still use it.
SQL SERVER – UDF – User Defined Function to Find Weekdays Between Two Dates
A user defined function that returns the number of weekdays between two dates, skipping Saturday and Sunday. It was written by Alexander Chigrik.
SQL SERVER – Collate – Case Sensitive SQL Query Search
Make a SQL Query Search case sensitive: add COLLATE Latin1_General_CS_AS to the WHERE clause so ‘casesearch’ matches one row instead of all four.
SQL SERVER – Random Number Generator Script – SQL Query
A random number generator in SQL Server needs the correct range and evaluation scope. These tested scripts cover integer bounds, repeatable seeds, per-row values, and common overflow mistakes.
SQL SERVER – Enable xp_cmdshell using sp_configure
Enable xp_cmdshell with sp_configure: turn on show advanced options, set xp_cmdshell to 1 and run RECONFIGURE. The full script is ready to run in SSMS.







