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.
| Author |
Topic |
|
kweegly
Starting Member
7 Posts |
Posted - 2009-07-18 : 10:15:46
|
| Hi everyone,I'm very new to SQL scripting and need your help with a script, I am trying to convert entrys in sql table that have an american date format.I can find the items using the following script which will show me the items which have a future date (these are causing the issue).Select ResourceItem_DateAdded from resourceItemWHERE ResourceItem_DateAdded > Getdate()Below is my attemp to change the dates to english format but i need to spcify that I want the current date entered to be changed into English date format but it current just changes the book dates to a standard date.update ResourceItem Set resourceItem_DateAdded = convert (datetime, 103)WHERE ResourceItem_DateAdded > Getdate()Thanks for the help :) |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-07-18 : 10:41:25
|
what is the data type for column ResourceItem_DateAdded ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
kweegly
Starting Member
7 Posts |
Posted - 2009-07-18 : 10:47:10
|
| sorry it is datetime, 05/12/2007 00:00:00 |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-07-18 : 10:57:46
|
if it already datetime there is no reason to change it at all.Datatime is not stored in any particular format in the database. It is in an internal format. What you see in query window when you select from that column is only how the Query Window present the date time to you.Any formatting of datetime to whatever format like YYYY-MM-DD or DD/MM/YYYY or MM/DD/YYYY should be done in your front end application where the date is being display. Date and time should be stored in the database in Datetime or smalldatetime and for SQL 2008, you have Date & Time data type. KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|