SELECT STUFF ( ( SELECT ',' + T1.FULLNAME AS [text()] FROM DBO.TABLE_1 AS T1 INNER JOIN DBO.TABLE_2 AS T2 ON T1.ID = T2.ID FOR XML PATH('') ) ,1,1,'' )
DECLARE @COLS NVARCHAR(2000) SELECT @COLS = COALESCE(@COLS + ',[' + CONVERT(NVARCHAR(100),T1.FULLNAME ) + ']','[' + CONVERT(NVARCHAR(100),T1.FULLNAME) + ']') FROM DBO.TABLE_1 AS T1 INNER JOIN DBO.TABLE_2 AS T2 ON T1.ID = T2.ID
No comments:
Post a Comment