Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
i have a field called mydate which is a datetime field --how can I query it so that the date is in one and the time in another --meaning select date as datefield, time as timefield from entries
Srinika
Master Smack Fu Yak Hacker
1378 Posts
Posted - 2006-08-16 : 12:17:25
U mean something like :Print convert(varchar(30), getdate(), 101)Print convert(varchar(30), getdate(), 114) Remember, these r coming as Varchar & not Date time type, if u want to convert it use the convert function again.For More info have a look at convert in BOLSrinika
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2006-08-16 : 12:18:53
SQL Server does not has time only data type. You can use convert() to convert datetime value to date only or time only or date + time.Or alternatively use your front end application to split date & time.KH
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)