Last active
November 4, 2016 17:40
-
-
Save pedroinfo/38a9791c37a2f6dcda118b4c997fe0cf to your computer and use it in GitHub Desktop.
c# Properties - Sql Server.sql
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
SELECT 'public ' + | |
CASE data_type | |
WHEN 'bigint' THEN 'int' | |
-- WHEN 'binary' THEN 'raw' | |
WHEN 'bit' THEN 'int' | |
WHEN 'char' THEN 'char' | |
WHEN 'datetime' THEN 'DateTime' | |
WHEN 'decimal' THEN 'decimal' | |
WHEN 'float' THEN 'float' | |
-- WHEN 'image' THEN 'long raw' | |
WHEN 'int' THEN 'int' | |
WHEN 'money' THEN 'double' | |
WHEN 'nchar' THEN 'string' | |
WHEN 'ntext' THEN 'string' | |
WHEN 'nvarchar' THEN 'string' | |
WHEN 'numeric' THEN 'int' | |
WHEN 'real' THEN 'decimal' | |
WHEN 'smalldatetime' THEN 'DateTime' | |
WHEN 'smallmoney' THEN 'double' | |
WHEN 'smallint' THEN 'int' | |
WHEN 'text' THEN 'string' | |
WHEN 'timestamp' THEN 'Date' | |
WHEN 'uniqueidentifier' THEN 'string' | |
--WHEN 'varbinary' THEN 'raw' | |
WHEN 'varchar' THEN 'string' | |
ELSE 'CHECK THIS.. ' + data_type + ' DataType' | |
END + ' ' + COLUMN_NAME + ' { get; set; }' | |
FROM information_schema.columns | |
WHERE table_name = 'Products' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment