DateTimeOffset.Now in T-SQL

SqlSql ServerTsqlSql Server-2008Datetime

Sql Problem Overview


I'm executing a INSERT to a sql 2008 db. How do I specify in T-SQL to insert NOW in a DATETIMEOFFSET column? GETDATE()?

Sql Solutions


Solution 1 - Sql

Maybe.

This would give you the local time of the server where SQL is installed.

Do you want to store timezone etc too? If so, SYSDATETIMEOFFSET() may be better

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRobertView Question on Stackoverflow
Solution 1 - SqlgbnView Answer on Stackoverflow