Created
April 10, 2016 15:55
-
-
Save SGCreations/e772d766b1158c1079d2207ea67b12f4 to your computer and use it in GitHub Desktop.
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 'replacewithtablename' into @table; | |
select 'replacewithdatabasename' into @schema; | |
select concat('public class ',@table,'{') | |
union | |
select concat('public ',tps.dest,' ',column_name,'{get;set;}') | |
from information_schema.columns c | |
join ( | |
select 'char' as orign ,'string' as dest union all | |
select 'varchar' ,'string' union all | |
select 'datetime' ,'DateTime' union all | |
select 'date' ,'DateTime' union all | |
select 'text' ,'string' union all | |
select 'int' ,'int' union all | |
select 'decimal' ,'decimal' union all | |
select 'tinyint' ,'bool' | |
) tps on c.data_type like tps.orign | |
where table_schema=@schema and table_name=@table union | |
select '}'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment