Hi there!
I am getting the following error when I run the following SP.
Server: Msg 137, Level 15, State 1
[Microsoft][ODBC SQL Server Driver][SQL Server]Must declare the variable '@maxid'.
Please help me. Thanx in advance.Code:CREATE Procedure spFindMax @tablename varchar(50), @pykey varchar(50) As Declare @SqlStr varchar(1000) , @maxid int set @SqlStr ='Select @maxid=ISNULL(max('+ @pykey + '),0) From ' + @tablename Exec (@SqlStr) print @maxid




Reply With Quote