Created
January 3, 2018 09:31
-
-
Save OskarKlintrot/90e12e5cfe9b9c0e56325cb2de65f665 to your computer and use it in GitHub Desktop.
A SQL query to find all columns in a table that is not nullable (good to have ie when populating a table for testing)
This file contains 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
USE DATABASENAME | |
DECLARE @table varchar(250) = 'TABLENAME' | |
SELECT name, is_nullable | |
FROM sys.columns | |
WHERE object_id = object_id(@table) | |
AND is_nullable = 0 | |
ORDER BY name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment