Last active
August 29, 2015 14:03
-
-
Save loonison123/e37ceb591fab4e54b3d6 to your computer and use it in GitHub Desktop.
Common Sql Snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Update statement with join | |
| UPDATE Table1 | |
| SET Table1.LastName = 'DR. XXXXXX' | |
| FROM Table1 T1, Table2 T2 | |
| WHERE T1.id = T2.id | |
| and T1.id = '010008' | |
| -- Alter column on existing table | |
| ALTER TABLE {TABLENAME} | |
| ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL} | |
| CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE} | |
| -- Multiple CASE statement | |
| CASE WHEN refnumber = '223' then 'true' | |
| WHEN notes = 'denied' then 'false' | |
| ELSE null as 'ColumnTitle' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment