3.4.10

With Sql Generate Parameters for store procedure

******************************************************************************
select '@' + LOWER(substring(column_name,1,1)) + substring(column_name,2,Len(column_name)) + ' ' + UPPER(Data_Type) + CASE WHEN character_maximum_length is null THEN ',' ELSE ' (' + CAST(character_maximum_length as VARCHAR(200))+ '),' END from Information_Schema.columns
where Table_Name ='studentbatchResult'
*******************************************************************************
select 'db.AddInParameter(command, "@' +
LOWER(substring(column_name,1,1)) + substring(column_name,2,Len(column_name)) + '", DbType.' +
CASE WHEN Data_Type = 'VARCHAR' THEN 'String' WHEN Data_Type = 'int' THEN 'Int32'
WHEN Data_Type = 'DateTime' Then 'DateTime' WHEN Data_Type = 'bit' THEN 'Boolean' WHEN Data_Type = 'text' THEN 'String' END + ', objUser.' + column_Name + ');' from Information_Schema.columns where Table_Name ='tbl_UserDetails'
********************************************************************************

No comments: