I need to declare a new variable called @DATES to have a date field called INV_DATE from the table to be moved to the new variable field for comparison. I need to do this because while having the INV_DATE in the CASE statement in the SELECT statement, I will need to include the INV_DATE field in the GROUP BY statement. I do not want the INV_DATE field in the GROUP BY statement because it throws off the report.
I get an error "Invalid column name 'INV_DATE'.". The INV_DATE is a valid field in the table. Somehow I am confusing the server. Can this be done?. Example of the code in the beginning of the script is shown below.
USE NewMrgnDB
DECLARE @DATES smalldatetime
SET @DATES = INV_DATE
I get an error "Invalid column name 'INV_DATE'.". The INV_DATE is a valid field in the table. Somehow I am confusing the server. Can this be done?. Example of the code in the beginning of the script is shown below.
USE NewMrgnDB
DECLARE @DATES smalldatetime
SET @DATES = INV_DATE