Viewing 4 posts - 16 through 19 (of 19 total)
DECLARE @CategoryIDString nvarchar(MAX)
DECLARE @ParameterIDString nvarchar2000)
set @ParameterIDString ='90001,90004,90005,90006,90007,90008,90009,90010,90011,90012,90013,90014,90015,90016,90017,90018,90019,90020,90021,90022,90023,90024,90025,90026,90027,90028,90029,90030,90031,90032,90033,90034,90035,90036,90037,90038,90039,90040,90041,90042,90043,90044,90045,90046,90047,90048,90049,90050,90051,90052,90053,90054,90055,90056,90057,90058,90059,90060,90061,90062'
--FORCREATING CATEGORY STRING---------------------
SET @strquery='DECLARE CATEGORYIDCURSOR CURSOR FOR '
SET @strquery=@strquery+ 'SELECT categoryid FROM parameter WHERE parameterid in('+@ParameterIDString+')'
execute sp_executesql @strquery
SET @CategoryIDString=''
OPEN CATEGORYIDCURSOR
FETCH NEXT FROM CATEGORYIDCURSOR...
September 16, 2008 at 9:57 pm
yes problem is of print statement. But whats the solution to see the full string generated.
ALso once the string is generated i want to execute it now.
i m using...
August 22, 2008 at 10:23 am
Following is the string generated from the code:
FETCH NEXT FROM CATEGORYIDCURSOR INTO @columnName
WHILE @@FETCH_STATUS=0
BEGIN
SET @CategoryIDString= CONVERT(nvarchar(max),(CONVERT(nvarchar(max),@CategoryIDString)+ convert(nvarchar(max),'SELECT [NAME] FROM category where categoryid=')+convert(nvarchar(max),@columnName) +convert(nvarchar(max),' UNION ALL ')))
PRINT @CategoryIDString
FETCH NEXT FROM CATEGORYIDCURSOR...
August 22, 2008 at 9:22 am
Viewing 4 posts - 16 through 19 (of 19 total)