Possibly a really dumb question but I am still a SQL Padawan.
Running SQL 2000 on Windows 2003
if i issue the command select Getdate() i get the reply in the format yyyy-mm-dd hh:mm:ss.mmm which is perfect.
I have a table that i want to be able to update with a script and it has a datetime column in the format that GetDate is showing.
If I use getdate() as a value to enter into the table, however, it enters in the format of MMM dd yyyy hh:mmAM which is not interpreted byt the program running on the DB.
I have also tried putting it in as a variable with the same results.
i.e.
Declare @timefield datetime
Set @timefield = (select getdate())
print @timefied
How can I get the select/insert statements to use the exact format that getdate uses when I call it on its own? Why does it change it? Is there an easier way?
Any help at all would be great!
EDIT: Added OS and SQL versions
Running SQL 2000 on Windows 2003
if i issue the command select Getdate() i get the reply in the format yyyy-mm-dd hh:mm:ss.mmm which is perfect.
I have a table that i want to be able to update with a script and it has a datetime column in the format that GetDate is showing.
If I use getdate() as a value to enter into the table, however, it enters in the format of MMM dd yyyy hh:mmAM which is not interpreted byt the program running on the DB.
I have also tried putting it in as a variable with the same results.
i.e.
Declare @timefield datetime
Set @timefield = (select getdate())
print @timefied
How can I get the select/insert statements to use the exact format that getdate uses when I call it on its own? Why does it change it? Is there an easier way?
Any help at all would be great!
EDIT: Added OS and SQL versions
Comment