General information
Forum:
Microsoft SQL Server
Environment versions
SQL Server:
SQL Server 2000
Hello.
I have the next store procedure:
CREATE PROCEDURE dbo.abc2
@server varchar(20),
@base varchar(20),
AS
DECLARE @pnCampo3 numeric(19,5)
DECLARE @cad varchar(1000)
set @pnCampo3 = 0.0
set @cad='select MAX(NOTEINDX) from ['+@server+'].['+@base+'].[dbo].[SY03900] '
exec(@cad)
set @pnCampo3=@pnCampo3+1.0
GO
but I need get the value of [exec(@cad)] in a variable in order to add (1) to the result, for example if [exec(@cad)] = 5 I need get 5+1=6.
I put somthing like this but is a error:
set @pnCampo3=exec(@cad)
How can I do this?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only