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 |
|
Aleph_0
Yak Posting Veteran
79 Posts |
Posted - 2011-08-01 : 19:01:59
|
| Hi again, just a quick question: I have a stored procedure that takes 2 date parameters (a start date and an end date), and I tried something like this:EXEC MyTableBuild Dateadd(YEAR, -1, @endDate), @endDateBut I'm getting an error that says:Msg 102, Level 15, State 1Incorrect syntax near 'YEAR'.Is the only solution to declare a new variable for the start date? My goal is to have this stored procedure take just one datetime parameter (@endDate) and be able to execute several other stored procedures that have their own datetime parameters that depend on @endDate in different ways.Thanks! |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-08-01 : 19:16:20
|
| TryEXEC (MyTableBuild Dateadd(YEAR, -1, @endDate), @endDate)JimEveryday I learn something that somebody else already knew |
 |
|
|
Aleph_0
Yak Posting Veteran
79 Posts |
Posted - 2011-08-01 : 19:31:42
|
| Still getting the same error, only it saysIncorrect syntax near 'MyTableBuild'Thanks though. |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-08-01 : 19:38:43
|
| EXEC (MyTableBuild ( Dateadd(YEAR, -1, @endDate), @endDate) )JimEveryday I learn something that somebody else already knew |
 |
|
|
|
|
|
|
|