|
ZMike
Posting Yak Master
110 Posts |
Posted - 03/15/2013 : 14:04:46
|
I have the following
DECLARE @DistinctSearch VARCHAR(MAX) SET @DistinctSearch = (SELECT Search FROM #AC)
As an example @DistinctSearch coming from the table = COALESCE([SQLQuery1] + ' ' , ' ') + COALESCE([SQLQuery2] + ' ' , ' ') + COALESCE([SQLQuery3] + ' ' , ' ')
SELECT ReportID , ReportSourceID , ReportServer , ReportName , AltReportName , ReportDescription , AltReportDescription , ReportPath , FullPath , Search = COALESCE(CAST([ReportID] AS VARCHAR (10)) + ' ' ,' ' ) + COALESCE(CAST([ReportSourceID] AS VARCHAR(50))+ ' ' ,' ' ) + COALESCE(CAST([ReportServer] AS VARCHAR(100)) + ' ' ,' ' ) + COALESCE(CAST([ReportName] AS VARCHAR(200))+ ' ' ,' ' ) + COALESCE(CAST([AltReportName] AS VARCHAR(200))+ ' ' ,' ' ) + COALESCE(CAST([ReportDescription] AS VARCHAR(300))+ ' ' ,' ' ) + COALESCE(CAST([AltReportDescription] AS VARCHAR(300))+ ' ' ,' ' ) + COALESCE(CAST([ReportPath] AS VARCHAR(200))+ ' ' ,' ' ) + COALESCE(CAST([FullPath] AS VARCHAR(300))+ ' ' ,' ' ) + ' + ' + @DistinctSearch
FROM A
It doesnt see the @DistinctSearch Properly. However if I copy and paste the results directly into the query it works. How to I make the query see it properly ?
|
|