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 |
IndraG
Starting Member
3 Posts |
Posted - 2012-11-14 : 02:13:49
|
I am more used to Access query, I want to query something with this kind of condition:"Where Format(tblJBT.TglAkad, "dd/MM/yyyy") = #01/10/2012#"The data includes hour and minutes, and with this Format function in Access, I can eliminate the hour and minutes, and query all data for that day (all hours and minutes within that day).I know T-SQL do not accept Format function, but I do not know how to do the same kind of function in T-SQL for SQL Server.Help, please? |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-11-14 : 02:23:44
|
where YourCol >= '20121001' and YourCol < '20121002' Too old to Rock'n'Roll too young to die. |
|
|
IndraG
Starting Member
3 Posts |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-11-14 : 03:00:32
|
See/execute this example on how to convert and format the actual datetime to dd/mm/yyyy by using convert() with style argument:select convert(varchar(10), getdate(),103)More info here:http://msdn.microsoft.com/de-de/library/ms187928.aspx Too old to Rock'n'Roll too young to die. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2012-11-17 : 03:55:39
|
quote: Originally posted by IndraG Well, to be honest, I have thought of that one. I thought there is a way to format a column during query? Simple if there is a need for it? Please?Software Toko|Software Akuntansi|Sistem Informasi Akuntansi|Sistem Informasi Manajemen
Formation is needed when you want to present that data to application layer. But in WHERE clause comparison it is not neededMadhivananFailing to plan is Planning to fail |
|
|
|
|
|
|
|