我要的结果是
id col1 New_col
1 adsfsd adsfsdasdfsdfasfdadf
2 asdfsdf adsfsdasdfsdfasfdadf
3 asfdadf adsfsdasdfsdfasfdadf
谢谢!
id col1 New_col
1 adsfsd adsfsdasdfsdfasfdadf
2 asdfsdf adsfsdasdfsdfasfdadf
3 asfdadf adsfsdasdfsdfasfdadf
谢谢!
SET @strTemp=''
select @strTemp=@strTemp+ dd from table2
print @strTemp
set @sql='select id,col1 ,New_col='''+ @strTemp + '''from table1'
exec (@sql)
SET @strTemp=''
select @strTemp=@strTemp+ col1 from table2
set @sql='select id,col1 ,New_col='''+ @strTemp + '''from table1'
exec (@sql)
SET @strTemp=''
select @strTemp=@strTemp+ col1 from table2
set @strTemp='select id,col1 ,New_col='''+ @strTemp + '''from table1'
exec (@strTemp)
SET @strTemp=''
SELECT @strTemp=@strTemp+col1 FROM table2
SELECT id,col1,@strTemp as New_col
FROM table1