Skip to content

Instantly share code, notes, and snippets.

@ashtewari
Created March 11, 2013 19:21
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 ashtewari/5136893 to your computer and use it in GitHub Desktop.
Save ashtewari/5136893 to your computer and use it in GitHub Desktop.
/* List all columns in the current database that are of datetimeoffset datatype */
Use $(DbName)
go
SELECT c.Object_ID
, OBJECT_NAME(c.OBJECT_ID) TableName
,c.name AS ColumnName
,SCHEMA_NAME(t.schema_id) AS SchemaName
,t.name AS TypeName
,t.is_user_defined
,t.is_assembly_type
,c.max_length
,c.PRECISION
,c.scale
FROM sys.columns AS c
JOIN sys.types AS t ON c.user_type_id=t.user_type_id
where t.name = 'datetimeoffset'
ORDER BY c.OBJECT_ID;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment