Results 1 to 2 of 2

Thread: Date Formats

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 1999
    Location
    Belfast
    Posts
    254

    Post

    Hello,
    I have an issue with running a select statement from a string built up in VB, when submitted to a stored procedure in SQL Server.
    Basically a variant is converted to a DATE data type in VB ( the get property returns a date ).
    If the date is greater than 12 ( say 17/02/99, 17th Feb 1999 ) and submitted to the query string SQL baulks at this returning error: Assertion 2001, Error Opening Recordset.
    If I manually run the SP with the string I get an out of range smalldatetime error.

    What I would like to know is:

    1. Does SQL Server expect dates in a particular format.
    2. If so how do I find out.
    3. Is there a workaround for this from either client or server ends? I have tried using format but since the date returned is a property it is read only.

    Sorry if this seems vague.

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    1. Sql Server does expect dates in a certain style but it's dependant on the DATEFORMAT command. In the default (or, the other US style, USA1) style, it will expect the month to be first. The style number you're trying to use is (3) British/French.
    2. O'Reilly has an Excellent book for SQL Server users, "Transact-SQL Programming", ISBN 1-56592-401-0. You can find out how to deal with this there.
    3. Try issuing the following, via an execute command:
    set dateformat "dmy"

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