when a.xtype =48 then ''''case when ''''+a.name+'''' is null then ''''''''NULL'''''''' else ''''+''''convert(varchar(6),''''+a.name +'''')''''+'''' end'''' -- when a.xtype =165 then ''''case when ''''+a.name+'''' is null then ''''''''NULL'''''''' else ''''+''''convert(varchar(''''+convert(varchar(4),a.length*2+2)+''''),''''+a.name +'''')''''+'''' end'''' when a.xtype =167 then ''''case when ''''+a.name+'''' is null then ''''''''NULL'''''''' else ''''+''''''''''''''''''''''''''''''''''''+''''+''''replace(''''+a.name+'''','''''''''''''''''''''''''''''''','''''''''''''''''''''''''''''''''''''''''''''''')'''' + ''''+''''''''''''''''''''''''''''''''''''+'''' end'''' else ''''''''''''NULL'''''''''''' end as col,a.colid,a.name from syscolumns a where a.id = object_id(@tablename) and a.xtype <>189 and a.xtype <>34 and a.xtype <>35 and a.xtype <>36 )t order by colid
Declare @sqlstr_B varchar(8000) select @sqlstr=@sqlstr+left(@sqlstr2,len(@sqlstr2)-1)+'''') ''''+left(@sqlstr1,len(@sqlstr1)-3)+'''')'''''''' ,''''''''''''+@tablename+'''''''''''' from ''''+@tablename
--select @sqlstr=@sqlstr+ '''' where CATLRID=''''''''''''+@str_bookid +'''''''''''''''' select @sqlstr=@sqlstr+ '''' where ''''+@ls_colName+ @ls_operator+''''''''''''''''+@str_bookid +'''''''''''''''' -- --print @sqlstr
select @sqlstr_B=''''insert into A_Imp_Insert_Sql(insertsql,flag) (''''+@sqlstr+'''')'''' --print @sqlstr_B