change type

  • how do I change the type in a stored procedure from varchar to datetime? I need my results to be in datetime format for one page so I can format it the way I need.

    I can't change the type in the database itself.

  • Declare @StringDate Varchar (50),

    @Date Datetime

    Set @StringDate = '15 Jan 2005'

    Select @Date = Convert(Datetime, @StringDate)

    Select @StringDate, @Date

  • I don't understand your reply. Here is what I have so far for my stored procedure.

    (

    @UserID Int

    )

    AS

    SELECT User_ID, Position_ID, Company_Name, Position_Title, Start_Date, End_Date

    FROM dbo.MySurvey_Positions

    WHERE User_ID = @UserID

    I need to change End_Date from varchar to datetime

  • SELECT User_ID, Position_ID, Company_Name, Position_Title, Start_Date, Convert(DateTime,End_Date) as End_Date

    FROM dbo.MySurvey_Positions

    WHERE User_ID = @userid

  • Remi - Curtis may mean using "alter procedure"....since he says he cannot change it directly in the database!

    Of course I could be totally wrong (not surprising that....)







    **ASCII stupid question, get a stupid ANSI !!!**

  • Maybe...not sure anymore.

Viewing 6 posts - 1 through 5 (of 5 total)

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