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 |
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2009-03-01 : 04:47:01
|
| hi, i have a column of TYPE DateTime like:2009-01-05 00:00:00.000 i want to be 05-01-2009 in column of Type DateTimehow can i do it?i write this query:SELECT Convert(DateTime,Convert (Varchar,Date,103)) As DateFROM TABLEthis error:The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-01 : 04:48:21
|
This is nothing else but a presentation issue.Presentation should be handled at the client side, not the database side.Leave datetime as is. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2009-03-01 : 05:02:43
|
| i need that to be in the DB |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-01 : 05:09:15
|
ALTER TABLE Table1ADD newDate AS Convert(char(10), Date, 103)) E 12°55'05.63"N 56°04'39.26" |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-03-01 : 23:51:55
|
| declare @date datetimeset @date ='2009-01-05 00:00:00.000'select @date, replace(convert(varchar(10),@date,103),'/','-'),convert(datetime,replace(convert(varchar(10),@date,103),'/','-')) |
 |
|
|
Mangal Pardeshi
Posting Yak Master
110 Posts |
|
|
|
|
|
|
|