Using CASE in MS SQL

Code to update a field using “CASE” (instead of using if-then-else):

Delete all rows in a table

SQL statement for MS SQL to delete all the rows in a table:

SQL Duplicate a Table

How to duplicate a table – structure and data – in MS SQL server:

select * into [NewTable] from [OldTable]


CREATE TABLE [NewTable] LIKE [OldTable];
INSERT [NewTable] SELECT * FROM [OldTable];


How to use Update in MS SQL Server:

MySQL Working with Nulls

Some useful MySQL commands:

How to find rows with null data and delete them:

delete from corridor where wb_id is null;

Note that this WON’T work:

delete from corridor where wb_id = null;

How to update a blank field: