Stored Procedure

 To Create :

WithOut Params:

CREATE PROCEDURE <stored procedure name>

AS

BEGIN

<Query/Logic>

END;

With Params:

CREATE PROCEDURE <stored procedure name>

(

    @prameter1 name  datatype,

    @prameter2 name datatype,

)

AS

BEGIN

<Query/Logic>

END;


To Declare:

Same as Create but in the place of Create line put DECLARE and remove AS 

DECLARE

(

    @prameter1 name  datatype = value,

    @prameter2 name datatype = value,

)

BEGIN

<Query/Logic>

END;


To Update/Modify:

Same as Create but in the place of Create line put Modify


To view:

sp_helptext <stored procedure name>


To Exec:

WithOut Params

EXEC <stored procedure name>

With Params

EXEC <stored procedure name>

@prameter1 name = value,
@prameter2 name = value



Comments

Popular posts from this blog