Specifically, I wish to get the date format in a pure (ISO) format:
YYYY-MM-DD HH:mm:ss
I’m looking for a SET command or something that I can use.
I do not wish to rely on the culture setting of the server.
Note: I’m interested in the string format in which dates are returned, not entered.
To change the default format you need to add a new language (sp_addlanguage), set it’s date format, then set the default language to it. More details can be found on this old technet article.
If you don’t want to do that, then you can change it ‘per connection’ using SET DATEFORMAT.
And if you don’t want to do that, then you can use CONVERT to convert it to the relevent format string in each query.