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 |
|
ranalk
Starting Member
49 Posts |
Posted - 2010-03-21 : 08:07:45
|
| Hi all,I have this stored procedure that can be called in the following way:EXEC dbo.pr_xxxxx '2010-03-20'I would like to use a dynamic input that would run the procedure on the day before, how can I convert getdate()-1 and call the SP using that input.I tried EXEC dbo.pr_xxxxx '+CONVERT(VARCHAR(10),GETDATE()-1,111)+'but I'm receiving date conversion error.Thanks in advance. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-03-21 : 08:41:56
|
Why don't you do that conversion in the stored procedure? N 56°04'39.26"E 12°55'05.63" |
 |
|
|
ranalk
Starting Member
49 Posts |
Posted - 2010-03-21 : 08:46:25
|
quote: Originally posted by Peso Why don't you do that conversion in the stored procedure? N 56°04'39.26"E 12°55'05.63"
I don't have permissions for doing that. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-03-21 : 09:59:08
|
[code]declare @datestr varchar(10)select @datestr = convert(varchar(10), getdate() - 1, 121)EXEC dbo.pr_xxxxx @datestr[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
ranalk
Starting Member
49 Posts |
Posted - 2010-03-21 : 10:03:39
|
quote: Originally posted by khtan
declare @datestr varchar(10)select @datestr = convert(varchar(10), getdate() - 1, 121)EXEC dbo.pr_xxxxx @datestr KH[spoiler]Time is always against us[/spoiler]
10x |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-22 : 11:45:50
|
| why should you convert it to varchar? is the parameter declared as varchar in proc?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|