SQL Server (Transact-SQL) Data Types to system_type_id list
I received metadata for a SQL Server 2008 R2 database which contained the system_type_id but not the data type itself. I ran a bunch of queries and logged the results to obtain a list of system_type_ids and the corresponding datatypes.
I looked on MSDN and was unable to find a list so I compiled one for usage for you google-ninjas who may find it handy.
system_type_id | datatype |
---|---|
34 | image |
35 | text |
36 | uniqueidentifier |
40 | date |
41 | time |
42 | datetime2 |
48 | tinyint |
52 | smallint |
56 | int |
58 | smalldatetime |
59 | real |
60 | money |
61 | datetime |
62 | float |
98 | sql_variant |
99 | ntext |
104 | bit |
106 | decimal |
108 | numeric |
122 | smallmoney |
127 | bigint |
165 | varbinary |
167 | varchar |
173 | binary |
175 | char |
189 | timestamp |
231 | nvarchar |
239 | nchar |
241 | xml |