AT appears in multiple parts of the SQL standard and vendor extensions.1. Time-zone context - AT TIME ZONE converts a timestamp without time zone into TIMESTAMP WITH TIME ZONE using the supplied zone. - AT LOCAL converts TIMESTAMP WITH TIME ZONE to the session time zone.2. Remote execution (T-SQL) - EXECUTE ( ... ) AT runs a command on a remote data source.Because AT is overloaded, its exact behavior depends on the clause in which it is used and the SQL dialect. Always verify your database documentation for supported forms and limitations.
TIMESTAMP or DATETIME
- The date-time value to convert.IDENTIFIER
- Registered linked server. If using time-zone forms only the first two parameters apply; for EXECUTE AT only the last parameter applies.SQL:1999 (AT TIME ZONE / AT LOCAL)
Use AT TIME ZONE:```SELECT TIMESTAMP '2024-05-18 10:00' AT TIME ZONE 'America/New_York';```
Yes. PostgreSQL lets you write `SELECT CURRENT_TIMESTAMP AT LOCAL;` to convert the current timestamp with time zone into the session's zone.
Only in SQL Server. Wrap the command string in EXEC and append AT .
The zone string must match the database's list. Check spelling and availability, and ensure your database has the latest tzdata files.