Procedure as a view : Procedure « Procedure Function « SQL Server / T-SQL Tutorial






6> CREATE TABLE Shippers (
7>      ShipperID int NOT NULL ,
8>      CompanyName nvarchar (40) NOT NULL ,
9>      Phone nvarchar (24) NULL
10> )
11> GO
1>
2>
3> INSERT Shippers VALUES(1,'Express','(503) 555-9831')
4> INSERT Shippers VALUES(2,'Package','(503) 555-3199')
5> INSERT Shippers VALUES(3,'Shipping','(503) 555-9931')
6> go

(1 rows affected)

(1 rows affected)

(1 rows affected)
1>    CREATE PROC spShippers
2>    AS
3>       SELECT * FROM Shippers
4>    GO
1>    EXEC spShippers
2>    GO
ShipperID   CompanyName                              Phone
----------- ---------------------------------------- ------------------------
          1 Express                                  (503) 555-9831
          2 Package                                  (503) 555-3199
          3 Shipping                                 (503) 555-9931

(3 rows affected)
1>    drop PROC spShippers;
2>    GO
1>
2>    drop table Shippers;
3>    GO








21.8.Procedure
21.8.1.calls the procedure
21.8.2.Declare a variable in a procedure
21.8.3.Stored Procedures as Parameterized Views
21.8.4.PRINT information out of a PROCEDURE
21.8.5.Procedure as a view
21.8.6.Return a value out of a procedure
21.8.7.Returning Values from a View as Stored Procedure Output Parameters
21.8.8.Filtering for Null Values with a Stored Procedure
21.8.9.Managing a Transaction Inside a Stored Procedure
21.8.10.Encrypting a Stored Procedure