| Author |
Topic  |
|
|
IndraG
Starting Member
Indonesia
3 Posts |
Posted - 11/14/2012 : 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
Flowing Fount of Yak Knowledge
Germany
8515 Posts |
Posted - 11/14/2012 : 02:23:44
|
where YourCol >= '20121001' and YourCol < '20121002'
Too old to Rock'n'Roll too young to die. |
Edited by - webfred on 11/14/2012 02:24:07 |
 |
|
|
IndraG
Starting Member
Indonesia
3 Posts |
|
|
webfred
Flowing Fount of Yak Knowledge
Germany
8515 Posts |
Posted - 11/14/2012 : 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
India
22461 Posts |
Posted - 11/17/2012 : 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 needed
Madhivanan
Failing to plan is Planning to fail |
 |
|
| |
Topic  |
|