SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE
-- Add the parameters for the stored procedure here
<@Param1, sysname, @p1>
<@Param2, sysname, @p2>
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT <@Param1, sysname, @p1>, <@Param2, sysname, @p2>
END
GO
replace
replace <@Param1, sysname, @p1>
replace SELECT <@Param1, sysname, @p1>, <@Param2, sysname, @p2> with any sql statement such as INSERT,SELECT,etc.
and here is a simple example:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[InsertPerson]
-- Add the parameters for the stored procedure here
@PersonName NVarChar(50)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @PersonNameID INT
INSERT INTO dbo.Person
(PersonName)
VALUES
(@PersonName)
END
so to run this I would type EXEC dbo.InsertHouse 'Ryan'