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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-09-12 : 18:44:06
|
| coemaw writes "I have serious problem for datetime. I want to store the date only in my sql database.So that how do i store date only in my database(Pleaz...). Moreover, I had already stored together datetime in my table.How can i seprate it. Reply me, as soon as possible. Proudly, Coe Maw" |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2006-09-12 : 18:47:00
|
| Why not use regular datetime or smalldatetime, and have your application or report program truncate the time portion? Most of these have a format function that can accept a mask like mm/dd/yyyy to display only the date portion.Rolling your own date types is fraught with peril, even MS dumped it after Beta 1 of Yukon/SQL 2005. You risk invalid dates and/or extensive programming to provide date arithmetic functions. |
 |
|
|
vgr.raju
Yak Posting Veteran
95 Posts |
Posted - 2006-09-12 : 19:00:31
|
| Hi, If you want to store the date only part,you can use thefunction some thing like {fn curdate()} .Otherwise you can use the convert function:select convert(varchar(255),getdate(),101)--09/12/2006select convert(varchar(255),getdate(),102)--2006.09.12select convert(varchar(255),getdate(),103)--12/09/2006select convert(varchar(255),getdate(),104)--12.09.2006select convert(varchar(255),getdate(),105)--12-09-2006select convert(varchar(255),getdate(),106)--12 Sep 2006I hope this helps!Thanks!Rajuhttp://www.trickylife-trickylife.blogspot.com/ |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
|
|
|
|
|
|
|