Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Update Query Error String not recognised date

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2007-01-15 : 16:54:30
I am getting an error, when i try to update the record.

If i pass the date value to the stored proc as '12/23/2006' it works fine.

And when i pass the date as '23/12/2006' then i am getting an error message

In the stored proc, the column datatype is defined as
[@ReceivedDate datetime]

String not recognized as date and time.

Since i want to use the app for two regions one UK and USA.

This is developed originally for USA and now also want to use in UK.
Can you please tell me how should i pass the date.

Update table Set ReceivedDate = @ReceivedDate where Tableid=@Rowid

Do i need to make any modification to the table or to the stored proc.
Thank you very much for the information.

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-01-15 : 17:19:27
Always pass string dates to SQL Server in format YYYYMMDD: 20061223

This is the only format that does not depend on the setting of DATEFORMAT, so it will work with any regional setting.






CODO ERGO SUM
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-15 : 17:22:00
Always use ISO date format YYYYMMDD when passing dates.

If you prefer not to, use SET DATEFORMAT { MDY | DMY}


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -