Hello, I got this errorThe variable name '@EMPID' has already been declared. Variable names must be unique within a query batch or stored procedure.
CREATE PROCEDURE [dbo].[Detail] @PeriodType varchar(255), @EmpID varchar(255), @Register VARCHAR(50), @SpecificPeriod varchar(255) ASbegindeclare @@rc int /* return code for called stored procedures */declare @sqlRC intdeclare @errMsg varchar(255)declare ....set nocount onset arithabort offset arithignore oncreate table #TmpJnlData( .....)declare JnlCursor CURSORFOR SELECT DISTINCT (EMP_ID) from #TmpJnlDatadeclare @EMPID varchar(50)OPEN JnlCursor FETCH NEXT FROM JnlCursor INTO @EMPID WHILE @@Fetch_Status = 0 BEGIN....
If I comment out @EMPID in my SQL SERVER Management Studio 2005 , then the error disappeared.The question is that in another machine,if I comment it out, the error will show up. If I uncomment it out, the error will occur.I don't know why. Both machine have the same version SQL SERVER.