Hi,
I may sound a foolish newbie, but I am totally frustrated trying to
create a new Stored procedure in SQL server Management studio. I made
all the database tables and created a diagram and the relationships
and even tried out VBA connectivity which is working fine. I tried
creating a stored procedure inside MS and got glued to it unable to do
it correctly.
[quoted text, click to view] >From the Object Explorer which is a tree view, I found my database, I
went to Programmability > Stored Procedures. Right clicked and
selected "New Stored Procedure" and it opened up a template as given
below.
-- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters
-- command (Ctrl-Shift-M) to fill in the parameter
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE <Procedure_Name, sysname, ProcedureName>
-- Add the parameters for the stored procedure here
<@Param1, sysname, @p1> <Datatype_For_Param1, , int> =
<Default_Value_For_Param1, , 0>,
<@Param2, sysname, @p2> <Datatype_For_Param2, , int> =
<Default_Value_For_Param2, , 0>
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
--------------------------------
I personalised the procedure to match my requirement and put a USE
<database> command on top and clicked save. Now MS after opening up
the save to dialog box is asking me to save the SQL query on some
location on my harddisk. "Mr. Management Studio, I need you to save
the procedure into the database, not outside." I cant find the
procedure in the Stored procedure section also after saving.
Any one here with a remedy? Help, I'm stuck on this simple thing for
two days.