SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 invalid parameter 1 specified for datediff
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rajesha
Starting Member

36 Posts

Posted - 10/15/2003 :  02:50:43  Show Profile  Reply with Quote
I have created a stored proc

CREATE PROCEDURE [Usp_GetccScholarship] AS
BEGIN

SELECT
scholarship_id

FROM
Scholarship.dbo.Scholarship
WHERE
Datediff("M",
cast(Ltrim(Rtrim(cast(course_month_start as char)))+'/1/'+Ltrim(Rtrim(cast(course_year_start as char))) as datetime),
cast(Ltrim(Rtrim(cast(course_month_end as char)))+'/1/'+Ltrim(Rtrim(cast(course_year_end as char))) as datetime))<='24'
END
GO

when am clicking check syntax it shows syntax is successfull
but when am clicking ok ot shows Error 1023 :invalid parameter 1 specified for datediff

Can anybody help me to solve this problem?

mohdowais
Sheikh of Yak Knowledge

United Arab Emirates
1456 Posts

Posted - 10/15/2003 :  02:59:55  Show Profile  Visit mohdowais's Homepage  Reply with Quote
Datediff accepts the following parameters for the datepart:

year, yy, yyyy
quarter, qq, q
month, mm, m
dayofyear, dy, y
day, dd, d
week, wk, ww
hour, hh
minute, mi, n
second, ss, s
millisecond, ms


Don't use quotes, and use lowercase.

Owais


Make it idiot proof and someone will make a better idiot
Go to Top of Page

rajesha
Starting Member

36 Posts

Posted - 10/15/2003 :  03:15:06  Show Profile  Reply with Quote
Thank you owasis it works.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 2.19 seconds. Powered By: Snitz Forums 2000