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)
 Procedure Question

Author  Topic 

nhaas
Yak Posting Veteran

90 Posts

Posted - 2012-12-22 : 23:16:46
is this type of Procedure possible, I have tried this and nothing happens. I have verified that the data is going to the Procedure.

CREATE PROCEDURE BillingUpdateVoip
(
@P varCHAR(50),
@P1 varCHAR(15),
@P2 varchar(15)
)
AS

Update VoipNumbers SET @P=@P1 where Voipnumber=@P2
GO

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-12-23 : 01:45:32
this procedure doesnt make any sense. whats the use of UPDATE if you're just trying to set a value for external variable? wont below be enough?

SET @P = @P1

if the attempt is to set the value of field which is passed dynamically then you need dynamic sql




CREATE PROCEDURE BillingUpdateVoip
(
@P varCHAR(50),
@P1 varCHAR(15),
@P2 varchar(15)
)
AS

DECLARE @SQLString varchar(8000)
SET @SQLString = 'Update VoipNumbers SET ' + @P + ' = ''' + @P1 + ''' where Voipnumber= ''' + @P2 + ''''

EXEC(@SQLString)
GO


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -