Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 more Stored Procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-07-13 : 08:22:49
Brenden writes "I have a stored procedure that takes to parameters. The table name and the keyfield name both as char data types.

From here I construct a SQL string
SET @strSql = 'SELECT MAX([' + @sKeyField + ']) as maxid FROM [' + @sTableName + ']'

After constructing the SQL I use the following line of code to execute the statement

EXECUTE sp_executesql @strSql

Is there any way after this line of code to get the maxid into a variable?"
   

- Advertisement -