Hi,
I am probably going to sound really stupid but I have recently installed SQL Server Management Studio and been trying to figure out how to create a stored procedure in it. I have created a database called 'BTL_Dictionary' and that works fine. In the Object Explorer window when I click on the database, I get the tree view of all the different options. In order to write the stored procedure , I clicked on Programmability --> Stored Procedures --> New Stored Procedure.
This opened up the template and i made the following changes to the template :
-- =============================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: blah
-- Create date:
-- Description: Adds the values into the DictionaryTable
-- =============================================
CREATE PROCEDURE [dbo].[AddDictionary]
-- Add the parameters for the stored procedure here
@.DictionaryID int ,
@.DictionaryName nvarchar(50),
@.DictionaryType nvarchar(50)
AS
BEGIN
-- Insert statements for procedure here
INSERT INTO DictionaryTable
(
DictionaryID,
DictionaryName,
DictionaryType
)
VALUES
(
@.DictionaryID ,
@.DictionaryName ,
@.DictionaryType
)
END
GO
-- =============================================
I saved the stored procedure, but when I refresh the database, I cannot see the stored procedure there. I trired re-opening the query and it indicates that the procedure belongs to the 'master' database instead of the 'BTL_Dictionary' database (its prefixed 'master.AddDictionary' instead of ''BTL_Dictionary.AddDictionary')
Can anyone tell me whats is is that I am doing wrong and how I can get rid of this .
Thanks
When you click "New Stored Procedure" MS will open a new query window with the PROC template in it. Just check that the database context is set to your database and not the master database. Or add a "USE" statement before the first statement in the template to ensure that the context is correct.
|||Thanks a lot for , that resolved the problem.