Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sunilsi
Starting Member
21 Posts |
Posted - 2009-01-02 : 09:35:39
|
Friends, I'm getting error:Unclosed quotation mark before the character string '' with the below SP. Please help alter procedure GetCalls(@value varchar(1))asbegindeclare @curDate datetime,@cst_date datetime,@Prev_4_day datetime,@sqlsel varchar(5000)set @curDate = getdate()set @cst_date = dateadd("n",-690,@curDate)if @value = '1'beginset @Prev_4_day = dateadd("d",-4,@cst_date)set @sqlsel ='select * from tblTrackingMain where status <> ''Closed'' and openTime < ' + @Prev_4_day + ' order by assFullname, severity, userPriority'''print @sqlselexecute(@sqlsel)endendLinus |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-02 : 09:41:59
|
quote: Originally posted by sunilsi Friends, I'm getting error:Unclosed quotation mark before the character string '' with the below SP. Please help alter procedure GetCalls(@value varchar(1))asbegindeclare @curDate datetime,@cst_date datetime,@Prev_4_day datetime,@sqlsel varchar(5000)set @curDate = getdate()set @cst_date = dateadd(n,-690,@curDate)if @value = '1'beginset @Prev_4_day = dateadd(d,-4,@cst_date)set @sqlsel ='select * from tblTrackingMain where status <> ''Closed'' and openTime < ' + @Prev_4_day + ' order by assFullname, severity, userPriority'print @sqlselexecute(@sqlsel)endendLinus
modify as above |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2009-01-02 : 09:48:18
|
you'll also need to make sure your date prints with single quotes, and cast it as a varchar. i.e....set @sqlsel ='select * from tblTrackingMain where status <> ''Closed'' and openTime < ''' + cast(@Prev_4_day as varchar(25)) + ''' order by assFullname, severity, userPriority' Em |
|
|
sunilsi
Starting Member
21 Posts |
Posted - 2009-01-02 : 12:06:25
|
Thank you so much... It works! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-02 : 12:36:32
|
cheers |
|
|
|
|
|
|
|