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 |
|
freephoneid
Yak Posting Veteran
52 Posts |
Posted - 2010-05-20 : 15:52:15
|
| Hi, Whats the best way to write a query using SQL Server 2008 for following? I need to get records from a table whose datetime > 20-May-2012 11:22:23 but < 25-May-2010 14:55:21Thanks! |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
freephoneid
Yak Posting Veteran
52 Posts |
Posted - 2010-05-20 : 15:57:43
|
| Hi, Thanks for quick reply. If my production server is in Central Time Zone, it'll store datetime in the server's timezone. Now, my question is that if I want to get the local time (assuming I'm in PST timezone), how do i do that using query?Thanks! |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
freephoneid
Yak Posting Veteran
52 Posts |
Posted - 2010-05-20 : 16:04:28
|
| Sorry, I should be more clear....Actulally customer may be in different timezones & I need to programatically calculate the local time. Can we do that using query? |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2010-05-20 : 16:07:28
|
| You can search the forums for my timezone converter function (udf_timezone_conversion). The one posted on this site does not have the fix for when the DST rules were changed a while ago, but it's a start at least. My function was corrected for the new DST rules, however I'm not the author of that so I can't post it.We use GMT on all of our servers since we support customers in multiple timezones. GMT works best in a situation like this since the offset is 0.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
|
freephoneid
Yak Posting Veteran
52 Posts |
Posted - 2010-05-20 : 17:00:48
|
| Hi Tara, When you recommend GMT time for server, are you referring to "GMT - Dublin, Edinburgh, Lisbon & London" or something different, since there are several options.Thanks! |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|
|
|