Skip to content

Instantly share code, notes, and snippets.

@joe-oli
Last active January 22, 2020 00:08
Show Gist options
  • Save joe-oli/75359e4ed01134499b73eccce9415f56 to your computer and use it in GitHub Desktop.
Save joe-oli/75359e4ed01134499b73eccce9415f56 to your computer and use it in GitHub Desktop.
SQL Server snippets
--bit(boolean) flag in SQL COlumn. To check for both false or Null use: isnull(MyTable.isBoolCol, 0) = 0
select * from MyTable
where isnull(MyTable.isBoolCol, 0) = 0
-- find all tables that have a DateTime column
select * from INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME like 'hlc%' -- tables starting with hlc
and data_type = 'datetime'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment