RhythmAddict112
Programmer
Hey all,
Thanks for looking at my post...I am sure I'm either not understanding something here, or just flat out doing something wrong but..the concatenation of the line below in read isn't working. (The value is null) How can I get this to concatenate?
Thanks for looking at my post...I am sure I'm either not understanding something here, or just flat out doing something wrong but..the concatenation of the line below in read isn't working. (The value is null) How can I get this to concatenate?
Code:
DECLARE @currYear varchar(4)
DECLARE @sqlQ varchar(8000)
DECLARE c1 CURSOR FOR
select parsedString from ParseString('2006,2005,2004', ',')
--ParseString() is a function that is basically doing a split()
OPEN c1
FETCH NEXT FROM c1
INTO @currYear
WHILE @@FETCH_STATUS = 0
BEGIN
[COLOR=red]set @sqlQ = concat('select * from lkp_h where k=' + @CurrYear,@sqlQ)[/color]
FETCH NEXT FROM c1
INTO @currYear
END
CLOSE c1
DEALLOCATE c1
select @sqlQ