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 |
inbs
Aged Yak Warrior
860 Posts |
Posted - 2013-02-22 : 08:03:58
|
hii have this query,and i want use paramate in cte,i get the error below, what's the problem?DECLARE @StockDate AS DATETIMESET @StockDate = (SELECT LastStockDate FROM FullDateStock)WITH CTE_getData AS(SELECT MAX(CurrDate) AS CurrDate,ProductFROM WHERE CurrDate<@StockDateGROUP BY Product)SELECT * FROM CTE_getData Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon. |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2013-02-22 : 08:06:36
|
quote: Originally posted by inbs hii have this query,and i want use paramate in cte,i get the error below, what's the problem?DECLARE @StockDate AS DATETIMESET @StockDate = (SELECT LastStockDate FROM FullDateStock);WITH CTE_getData AS(SELECT MAX(CurrDate) AS CurrDate,ProductFROM fromWhat???WHERE CurrDate<@StockDateGROUP BY Product)SELECT * FROM CTE_getData Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
Too old to Rock'n'Roll too young to die. |
|
|
|
|
|