Category Archives: SQL

Information related to SQL programming and diagnostic techniques

SQL Cheatsheet

August 15, 2024

Multiple “Order By” Clause Separate the order by clauses with commas. Use “CASE” to Convert Non-String to String Value In this example, we want do display the SettlementType value (an integer) as a human readable value in a column named “Settlement”. Resulting SQL view. Update Row Value The basic command is: For instance:

Shrink DB Files to Reclaim Disk Space

July 26, 2023

While working on a project that uses WCF to connect to an endpoint that checks SQL for my credentials, I suddenly started receiving errors from SQL Server in the Event Log reporting: The transaction log for database ‘…’ is full due to ‘LOG_BACKUP’. Then the app was stuck with the message whenever I (attempted to) start it. After… Read More »

Search SQL Database for Instances of Column Data Type

April 20, 2023

I needed to search an entire database to find 64-bit integer data types were being used to make sure I was handling them correctly. I needed to create a query to find all the columns in the database that are SQL bigint type. I found a and modified it to get the location information I needed. Other Uses

SQL Variable, Temporary and Global Tables

March 1, 2023

SQL procedures can create multiple types of table entities – it’s up to you do decide which one is best. The Simplest: Table Variable If you just want to capture some information to be used in the body of a stored procedure and the table creation and usage is in a single batch (no “GO” statement between creation… Read More »

SQL Scalar Variables

February 28, 2023

SQL scalar variables (otherwise known as local scalar variables) must be defined with type and set to a value before the variable can be used. This can be done in two steps or as a single step. Additional Links