Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ersantosh1
Starting Member
6 Posts |
Posted - 2012-04-20 : 10:38:20
|
Hi, i got resultstring like lsresult=107,108,109,110 those are template idswhose names i have to get in following fashion...lsnames = GEN,VEN,TEN,SENi have query like select TEM_NAME FROM MST_TEMPLATE WHERE TEM_ID IN (107,108,109,110);SHOULD I GET RESULT IN THIS FASHION lsTempName=GEN,VEN,TEN,SENbecauese i have to use that variable on my Jsp page like <%=lsTempName%> Plz helpThankssantoshsrahangdale |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-04-20 : 11:49:36
|
quote: SHOULD I GET RESULT IN THIS FASHION lsTempName=GEN,VEN,TEN,SEN
Are you asking whether that would be the format output of the select statement? If so, it won't be. The result will be four rows of data, rather than comma-separated result.If you do want to make it comma-separated, you can use the xml path approach. For example, see this thread: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=173794 |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-20 : 15:32:18
|
quote: Originally posted by ersantosh1 Hi, i got resultstring like lsresult=107,108,109,110 those are template idswhose names i have to get in following fashion...lsnames = GEN,VEN,TEN,SENi have query like select TEM_NAME FROM MST_TEMPLATE WHERE TEM_ID IN (107,108,109,110);SHOULD I GET RESULT IN THIS FASHION lsTempName=GEN,VEN,TEN,SENbecauese i have to use that variable on my Jsp page like <%=lsTempName%> Plz helpThankssantoshsrahangdale
why bnot bring them as a resultset from sql and then generate comma seperated list from front end?If not you've use UDF or use XML blaclbox method for generating csv------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|