I am unfamiliar with SQL Server, and would like to do some ad-hoc searches in a dockerized legacy SQL Server database using SQL Server Management Studio where one of the fields is a datetime and I would like to use the BETWEEN operator to extract for a given period.
So something like
/****** Script for SelectTopNRows command from SSMS ******/ select card, sum(amount) as sum, count(*) as count FROM ... where cardused between '01-03-2021' and '03-03-2021' group by card
Now my problem is that this is interpreted as MDY dates and not DMY dates (which is what we use here). Server is TZ'ed to Europe/Copenhagen. My Windows 10 speaks Danish. If I run
set dateformat dmy; first it is interpreted as expected.
Is there a documented format that always interprets correctly when used in a query string regardless of server settings?
Based on earlier work with Excel this might be something like
to get this in my local timezone. Server and client will both run in the same timezone eventually - would this be an issue?