How can I set my timestamp to a specific time zone, particularly US/Pacific?
Consider this MWE:
CREATE TABLE #timingTable (theTime datetime2(0))
INSERT INTO #timingTable SELECT (SELECT CURRENT_TIMESTAMP);
select * from #timingTable;
>Solution :
You can use SYSDATETIMEOFFSET to get the current time with the offset, and then use AT TIME ZONE to convert it to the timezone you want the datetime stored in.
CREATE TABLE #timingTable (theTime datetime2(0))
INSERT INTO #timingTable SELECT SYSDATETIMEOFFSET() AT TIME ZONE 'Pacific Standard Time';
select * from #timingTable;