SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Procedure Question
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

nhaas
Yak Posting Veteran

USA
90 Posts

Posted - 12/22/2012 :  23:16:46  Show Profile  Visit nhaas's Homepage  Reply with Quote
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

India
52317 Posts

Posted - 12/23/2012 :  01:45:32  Show Profile  Reply with Quote
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/


Edited by - visakh16 on 12/23/2012 02:16:18
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.17 seconds. Powered By: Snitz Forums 2000