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 |
rookie_sql
Constraint Violating Yak Guru
443 Posts |
Posted - 2006-04-24 : 10:14:01
|
Hi i want to split my StartTime into a date format like 01-01-2006 it currently looks like "2006-04-20 00:00:00.000"i tried to use the convert statement below but i can't recall number you use to only show the date part Update Transferset [Date] = convert(varchar(10),StartTime, 102) |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-04-24 : 10:27:00
|
You should format the date in your front end application. Dont worry how sql server stores it in tableMadhivananFailing to plan is Planning to fail |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-04-24 : 21:09:09
|
[code]it is convert(varchar(10), StartTime, 105)[/code]Refer to SQL Server Books Online on CAST & CONVERTquote: Update Transferset [Date] = convert(varchar(10),StartTime, 102)
Why do you want to store the date in string format in your [Date] column ? Always store date & time in datetime data type or smalldatetime and use your Front End or Reporting tool to format the date. KH |
|
|
|
|
|