SQL date conversion minus days

Just to point out, in case important, that this is "subtracting 1 day" from the EXACT TIME now, so this is NOT Midnight-yesterday. So if you use it as a range you will start from "this exact time yesterday" rather than "all of yesterday".

@ScottPletcher code

DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()) - 1, 0)

will "round" the GETDATE()) - 1 value to "whole days" so will be start-of-day, yesterday.,

It looks like a complicated formula but the benefit (over converting to VARCHAR) is that it is all integer arithmetic, so is much more efficient that a string conversion.

Also, SQL is notoriously ambiguous in Date/String conversions - it depends on the Server Settings, and even the Language of the currently connected user, so is prone to change and likely to cause programs to fail unexpectedly.