logo       

SQL: msg#00354

windows.devel.dotnet.winforms

Subject: SQL

Can someone tell me what is wrong with this? I get the error:

----------------
Server: Msg 137, Level 15, State 2, Line 16
Must declare the variable '@TABLE_NAME'.
----------------


DECLARE @INSTALLATION_DATE DateTime
DECLARE @NO_MONTHS int
DECLARE @EMPTY_MONTHS varchar(50)
DECLARE @COUNTER int
DECLARE @TABLE_NAME varchar(50)

SET @TABLE_NAME = '__After_Hours_Monthly'
SET @COUNTER = 0
SET @INSTALLATION_DATE = (Select Installation_Date From
__Installation_Date)
SET @NO_MONTHS = DATEDIFF(m,@INSTALLATION_DATE,GETDATE())

WHILE @COUNTER > 0

SELECT * FROM @TABLE_NAME
SET @COUNTER = @COUNTER - 1



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise