TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Venkat Govind
1.2k
557
67k
Hcan i pass where condition in below query?
May 23 2015 4:49 AM
DECLARE @WFavailablequery nVARCHAR(max)
DECLARE @WFavailablecolumn nVARCHAR(max)
SELECT @WFavailablecolumn = STUFF(( SELECT'],['+ Tradecat FROM mstr_tradecategory order by '],[' + convert(nVARCHAR(max),Tradecat) FOR XML PATH('')), 1, 2, '') + ']'
SET @WFavailablequery ='SELECT VendorName,VendorCode,' + @WFavailablecolumn + ' FROM( SELECT wf.VendorCode,VendorName,Tradecat
FROM dbo.mstr_workforce as wf inner join mstr_vendor as v on v.VendorCode=wf.VendorCode
left outer join mstr_tradecategory as tc on tc.TrcatCode=wf.Category where v.VendorCode='+LTSBV000001+')
mstr_workforce PIVOT (count(Tradecat) FOR Tradecat IN ('+@WFavailablecolumn+')) AS pvt'
EXECUTE (@WFavailablequery)
Hi Please help me any one ,
I dont know how pass where condition in above query
Reply
Answers (
1
)
facing a problem while downloading a file
upload and feedback