Results 1 to 3 of 3

Thread: question about a sql server stored procedure

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    outerspace
    Posts
    126

    question about a sql server stored procedure

    I wrote this and the syntax is fine however when i go to execute it in query analyzer it throws me and error about the '2/7/2003' Any ideas the column with the date is a datetime format

    CREATE PROCEDURE dbo.TimesAccessed(@BeginDate datetime,@EndDate datetime) AS
    SELECT UserName, location, AccessDate
    FROM UserStats
    WHERE (AccessDate > @BeginDate) AND (AccessDate <@EndDate )
    GO


    exec dbo.TimesAccessed('2/7/2003','2/15/2003')
    "All those who wonder are not lost" -j.r.r tolkien

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    Get rid of the parenthesis, they are required when executing a literal string or variable, not when passing in parameters.

    exec dbo.TimesAccessed '2/7/2003', '2/15/2003'

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    outerspace
    Posts
    126
    yep that did it thanks
    "All those who wonder are not lost" -j.r.r tolkien

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width