Posts

SQL server tips

Image
prevent SQL Server from giving you informational messages during and after a SQL statement execution? SET NOCOUNT OFF  By Mistake, Duplicate records exists in a table, how can we delete copy of a record ? with T as (     select * , row_number() over (partition by VID  order by VID) as rank     from dbo.tbl_AppVolunteers )   delete from T where rank > 1

How to determine the timezone of SQL server?

Image
SELECT SYSDATETIMEOFFSET() DECLARE @TimeZone VARCHAR(50) EXEC MASTER.dbo.xp_regread 'HKEY_LOCAL_MACHINE', 'SYSTEM\CurrentControlSet\Control\TimeZoneInformation', 'TimeZoneKeyName',@TimeZone OUT SELECT @TimeZone