PDA

Click to See Complete Forum and Search --> : Date Formats


lenin
Oct 20th, 1999, 07:05 PM
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.

JHausmann
Oct 21st, 1999, 02:24 AM
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"