Skip to content

Tag: sql-server

Query by a specific month when you only have start and end dates

I need to query a MS SQL table of events by a specific month. In this scenario, I want to return all events which took place during May 2020. I would expect to return ID’s 1, 6 and 9. I’m finding this query quick tricky, so thanks in advance for any help. Answer This article explains why you can u…

What is the syntax of a string literal in T-SQL?

What is the full syntax of a string literal in T-SQL? I could not find any explicit definition of string syntax in the official documentation, and any blog post I could find only mentioned certain aspects (like the N prefix). Additionally, any posts on Stack Overflow or other sites that asked how to escape a …