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

Datediff for SQL

Status
Not open for further replies.

wendas

MIS
Apr 20, 2001
92
US
Hi,
I am a real newbie to SQL.. I have plans to go to school for it comming up but till then I am creating my stored procedures using access & then retyping them over into SQL.

I need to do a difference for dates.. Access successfully works with datediff('m',date1,date2)as MthDiff .. but when entered into SQL it errors with

"Error 1023", SQL server invalid parameter 1 specified for datepart.

I tried a few other combos like datediff(date1,date2,'m')
datediff(date1,date2)
datediff('ww',date1,date2)
with errors that made me sure the format was really wrong, or similar errors... Can anyone help?
Thanks
Wenda
 
Thanks, but this did not seem to help..

It may be because I did not state I am a very old SQL server, (version 6.5)

But datediff(m,date1,date2) produced the error...

error 155: [sql server] 'm' is not a recognized datediff option.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top