Dynamic Query for XML?
-
Hi all, DECLARE @DocsList nvarchar(max); SELECT @DocsList = STUFF( (SELECT ', ' + quotename(Particulars) FROM [101_SalaryParticulars] GROUP BY Particulars ORDER BY Particulars FOR XML PATH('')) , 1, 2, ''); I wants to change the above query dynamically. My table name will vary like '[102_SalaryParticulars]','[103_SalaryParticulars]' Etc.,
Software Engineer AcSys IT Software Solution
-
Hi all, DECLARE @DocsList nvarchar(max); SELECT @DocsList = STUFF( (SELECT ', ' + quotename(Particulars) FROM [101_SalaryParticulars] GROUP BY Particulars ORDER BY Particulars FOR XML PATH('')) , 1, 2, ''); I wants to change the above query dynamically. My table name will vary like '[102_SalaryParticulars]','[103_SalaryParticulars]' Etc.,
Software Engineer AcSys IT Software Solution
kasimmohamed wrote:
'[102_SalaryParticulars]','[103_SalaryParticulars]'
Then you deserve all the horror you are going to get with such a terrible design. You should have 1 table with different key for 102 and 103!
Never underestimate the power of human stupidity RAH
-
kasimmohamed wrote:
'[102_SalaryParticulars]','[103_SalaryParticulars]'
Then you deserve all the horror you are going to get with such a terrible design. You should have 1 table with different key for 102 and 103!
Never underestimate the power of human stupidity RAH
-
Mycroft Holmes wrote:
You should have 1 table with different key for 102 and 103
I agree with your point, but it is not uncommon to see such design in OLAP databases.
-
Mycroft Holmes wrote:
You should have 1 table with different key for 102 and 103
I agree with your point, but it is not uncommon to see such design in OLAP databases.
And if he is mucking around with OLAP databases and can't work out how to concatenate a string then they have bigger problems!
Never underestimate the power of human stupidity RAH