Error 1023 :invalid parameter 1 specified for date

  • 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?

  • You don't need the quotes round the first parameter to datediff. i.e. it should be:-

    SELECT scholarship_id

    FROM Scholarship.dbo.Scholarship

    WHERE Datediff(m,cast..........

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply