Skip to content
Advertisement

SQL How to correctly set a date variable value and use it?

I have the following query which uses a date variable, which is generated inside the stored procedure:

The problem is that the @sp_Date value appears to be being ignored and I am wondering why? Have I defined or used it incorrectly?

Advertisement

Answer

Your syntax is fine, it will return rows where LastAdDate lies within the last 6 months;

Are you sure LastAdDate is of type DATETIME?

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement