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 2005 Forums
 Transact-SQL (2005)
 Interesting error on date format

Author  Topic 

ching1874
Starting Member

11 Posts

Posted - 2011-06-27 : 04:48:29
Hi all,

I have a stored procedure which insert records on a table. The store procedure will take in some parameter and one of the parameters is @effective_date Datetime

In my development environment, one of the pages in the .NET web application, I submit the details and it will call this stored procedure and no errors was found. However, problem was found in production and the error message is "Error converting data type varchar to datetime."

So my question is why the development doesn't hit the error??? so strange!!!

when i use SQL Profiler in the development, it shows me the stored procedure being called and if i run the stored procedure it will return error too.

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-06-27 : 05:04:48
Could be different localle on production (different default date format) - you shouldn't rely on the environment to set the date format.
Probably you are getting incorrect dates for days before the 13th of the month too.


==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

ching1874
Starting Member

11 Posts

Posted - 2011-06-27 : 05:11:29
thanks for the quick reply
but i have checked both web and db server, they are all using dd/mm/yyyy in development and production
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-06-27 : 05:37:50
Have a look what
DBCC USEROPTIONS
will show you.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -