Hi,
I noticed that some of my Stored Procedure is not working well on the production server cause it seems that it has not the same DateTime format...(amongst other things ).
Example of differences between DateTime format :
----------------------
My station (SQL Express 2005) : 26/06/2007 3:17:20 PM
Production server (SQL 2005 Enteprise) : 2007-06-26 15:17:20
How can i make the format of the database unchangeable so it keep the same format on the production server?
I use SQL Express 2005 for coding and SQL 2005 Enteprise for production.
Thanks
check the region settings in the production server's OS and make them the same
|||Ok nice it works.
But if i had no access to the production server (if i host my web site on godaddy for example), what else can we do?
|||That's a good question that I can't answer - you might contact them and see if they have any servers running on the same format as yours, so that they could transfer your domain there...other than that - I have no idea.
|||http://msdn2.microsoft.com/en-us/library/ms142797.aspx
You can set the language in your connect string. Alternatively, you can issue the SET LANGUAGE / SET DATEFORMAT explicitly yourself before your SQL commands.
Although ultimately, that is telling me that you are treating your datetime's as strings (and/or using string concatenation instead of parameterized queries). Both of those are bad practices, should be changed, and then you wouldn't care about the server's language either.
|||Hi,
Ok i understand.
I use :
.....@.DateFinale varchar(30), ...
select @.stmt = 'SELECT *
FROM Categories
WHERE CategoryID =' + @.CategoryID + ' AND DateOnCreate >=''' + @.DateFinale + ''' ORDER BY DateOnCreate DESC'
What will be the code above if i change the type of @.DateFinale for @.DateFinale DateTime?
Thanks for your help.
No comments:
Post a Comment