Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@benatkin
Created April 30, 2009 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benatkin/104645 to your computer and use it in GitHub Desktop.
Save benatkin/104645 to your computer and use it in GitHub Desktop.
-- List all nvarchar and varchar columns in SQL Server database
SELECT OBJECT_NAME(col.OBJECT_ID) as [TableName], col.[name] as [ColName], typ.[name]
FROM sys.all_columns col
INNER JOIN sys.objects obj
ON col.object_id = obj.object_id
INNER JOIN sys.types typ
ON col.user_type_id = typ.user_type_id
WHERE col.user_type_id IN (167,231)
AND obj.type = 'U'
ORDER BY name, TableName, ColName
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment