ALTER TO - SQL SERVER

-1

In my bank I have 2 stored procedures, dbo.A and dbo.B. in the procedure dbo.A there are the parameters @name, @rua in the procedure dbo.B there are the parameters @cep, @telefone

But I also need to have the dbo.A rbo parameter in dbo.B. I need to do it via Microsoft SQL SERVER Management QuerySql.

    
asked by anonymous 28.04.2016 / 13:04

1 answer

2

I do not know if I understood your question correctly. To add a parameter to a procedure, you must rewrite it in its entirety. You can not only change the parameters.

For example: typing sp_helptext dbo.B you'll get something like:

CREATE PROCEDURE dbo.B
  @cep varchar(20)
, @telefone varchar(20)
AS
SELECT @cep, @telefone

To add a new parameter to it, you would have to do:

ALTER PROCEDURE dbo.B 
  @cep varchar(20)
, @telefone varchar(20)
, @rua varchar(200)
AS
SELECT @cep, @telefone, @rua
    
02.05.2016 / 03:39