Wednesday, April 15, 2015

Sql Stored Procedure

  • Syntax for creating Procedure
  • We can insert row using SP
  • W can delete rows using SP
  • We can change Data Type of any column using SP
  • We can drop same table of which we are executing the SP
  • Stored Procedure can accept parameters
  • Triggers will be called from SP
  • Trigger will be called  even if there were no action took place of Delete Sql statement written in SP
  • Create procedure must be the first line in the batch this is why we have to use GO keyword
Syntax for creating procedure without Parameter

CREATE PROCEDURE Your Procedure Name
      SELECT *
      FROM   Your Table Name

Syntax for creating procedure with Parameter

    SELECT *   FROM   test1    

        WHERE  empid = @ID   AND NAME = @name 

No comments:

Post a Comment