Sunday, July 8, 2018

How to get current Time Zone details in SQL Server?


You may come across a situation in which you require to get the current timezone in SQL SERVER. The details can be get using the sp_regread procedure which takes the registry key as input parameter and giving out the timezone details.

Query:
  
     
     DECLARE @TimeZone VARCHAR(50)

EXEC MASTER.dbo.xp_regread 'HKEY_LOCAL_MACHINE', 
'SYSTEM\CurrentControlSet\Control\TimeZoneInformation',
'TimeZoneKeyName',@TimeZone OUT

SELECT @TimeZone
           






Share This
Previous Post
Next Post

TekGrabs, established in 2017, is in the business of sharing Information. It provides news, articles and photos about the different technologies, inventions in different domains. Provides information on programming and databases.

0 comments: