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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL ' Dates

Status
Not open for further replies.

Cullen411

Programmer
Aug 17, 2005
89
GB
Both these SQL statements work one has the ' as delimiters, which one has the right syntax?

SELECT * FROM tblTable WHERE GETDATE() - DATETIMESTARTED <iDays

SELECT * FROM tblTable WHERE GETDATE() - 'DATETIMESTARTED' <iDays

thanks.
 
If DATETIMESTARTED is column from tblTable - first one.

If DATETIMESTARTED is date constant - second one.

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
Ok it's a column value so it's the first one.
Any reason why this is the case?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top