Hi,
In SQL Server is there a way to change the way to enter a date? The field is a datetime. I have to put dd/mm/yyyy otherwise it failed...but I prefer to have yyyy/mm/dd. What do I have to do if I want users to enter yyyy/mm/dd?
Thanks
Printable View
Hi,
In SQL Server is there a way to change the way to enter a date? The field is a datetime. I have to put dd/mm/yyyy otherwise it failed...but I prefer to have yyyy/mm/dd. What do I have to do if I want users to enter yyyy/mm/dd?
Thanks
SQL Server should be able to accept any date format that it can recognize as a valid date. I know that yyyy-mm-dd works, in fact I think that is how SQL Server actually stores it. Well technically, it stores it as integers, but that's how Query analyzer will show it to you. Enterprise Manager uses your system settings.
The point is it shouldn't be failing if you are using something other than dd/mm/yyyy. That is definately not the only valid format.
If you can't get it to work though, you always have the option in VB of reformatting the date before passing it to SQL Server. Look up "User-Defined Date/Time Formats (Format Function)" in VB help. It explains the options for the Format Function which will allow you to reformat the user's input.
--KSW
I think that you can choose the date format in the field properties of the table.
Ok, but I can't believe there is no way to do this in Enterprise Manager!!
I'll use the formatdatetime,
thanks
I am sure that you can do it from Enterprise Manager. Unfortunately I don't have DBA or DBO rights on our database so I couldn't tell you how you would go about doing it because I have never had a chance to play around with this stuff.