Need the current database name in a script? SELECT DB_NAME() returns the name of the database you are running the query in. It is a one line answer.
Weighted Scores: Ranking Products by Several Columns at Once
Adding rating to units sold ranks by whichever column is biggest. Scale first, weigh second, and keep the weights in a table anyone can read.
NULL Sort Order: Put Missing Values Where Readers Expect
NULL sort order uses a CASE bucket to put missing values last. Keep a stable tie breaker and preserve the original score.
CHAR: Invalid Character Codes Return NULL
CHAR constructs a character instead of printing an integer. Preserve byte-code inputs and distinguish an ordinary space from missing output.
SQL SERVER – Import CSV File Into SQL Server Using Bulk Insert – Load Comma Delimited File Into SQL Server
How to import CSV file data into SQL Server with BULK INSERT: create a table, point to the comma delimited file and load every row in a few quick steps.
SQL SERVER – Simple Example of WHILE Loop with BREAK and CONTINUE
A very simple example of WHILE Loop with BREAK and CONTINUE, plus a Books Online sample that uses a SELECT query in the WHILE condition.







