Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Smarlist SQL

Status
Not open for further replies.

bradth

IS-IT--Management
Feb 18, 2005
142
CA
I current have a SQL Query that I have written that contains variables (DECLARE @DATE003 datetime, etc.) When I try to place this query in the smartlist builder SQL Script, I get the error "Incorrect syntax near the keyword 'DECLARE'" ODBC error 37000. Any idea why this error displays? With the SQL script, will it not accept variables in smartlist builder? Thanks.

Brad [spidey]
 
try re-writing the query.

So if after the declare later you have
Code:
Set @DATE003 = DATEADD(yy, DATEDIFF(yy,0,getdate()), 0) /*get the first day of the year*/

Just substitute in the 'right side' where there is a variable.

A number of products will support the SQL select, but NOT a SQL Script... not sure if this is the case here (since I did not do the smartlist builder this way) but it sounds like a safe bet
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top