conctenation error in sqlserver 2008

Posted by Klbaiju under Sql Server on 7/7/2013 | Points: 10 | Views : 1088 | Status : [Member] | Replies : 1
Hi all,
I want to concatenate a string in a query, it showing error following is query

SELECT CONVERT(VARCHAR(20), Month_date,106 )as tourdate , ' + @cols +' from (
select t.Month_date,b.bus_id,b.tour_date,b.[status],b.fare from #temp t left outer join Busdetails b on t.Month_date=b.tour_date
) x
pivot
(
max(status)
for bus_id in ( ' + @cols + ')
) p
order by Month_date
drop table #temp
error in second @cols
ie
max(status)
for bus_id in ( ' + @cols + ')
) p
there is no error in first line containing @cols
how to solve this

Regards
Baiju




Responses

Posted by: lakhansin-22735 on: 7/8/2013 [Member] Starter | Points: 25

Up
0
Down
Hi

Exact what error you are facing while executing this SQL query?

Lakhan Singh
Tech Lead
BeyondKey System Pvt. Ltd.
Indore, M.P.
India

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response