Question : help with stored procedures in MS SQL server

I'm trying to write a new stored procedure in Server Management Studio Express 2005.

I've written the procedure but when I try to run it it says it can't be found.

Here is what I run and the message I get:
exec email_input '[email protected]', '7/19/2010'

Msg 2812, Level 16, State 62, Line 1
Could not find stored procedure 'email_input'.



I know my procedure exists because when I run it again I get:
Msg 2714, Level 16, State 3, Procedure email_input, Line 17
There is already an object named 'email_input' in the database.


Here is my stored procedure. Does anyone know why I can't find it?
-- ================================================
-- 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 email_input
      -- Add the parameters for the stored procedure here
      @p_user_email varchar(25),
      @p_entry_date datetime
AS
BEGIN
      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.
      SET NOCOUNT ON;

    -- Insert statements for procedure here
            INSERT INTO TOD_email (user_email, entry_date)
            VALUES (@p_user_email, @p_entry_date)
END
GO



Answer : help with stored procedures in MS SQL server

make sure that you always specisy the schemaname while creating the objects, also make sure that you are on the right database while executing them

CREATE PROCEDURE dbo.email_input --------------  here
      -- Add the parameters for the stored procedure here
     @p_user_email varchar(25),
     @p_entry_date datetime
AS
BEGIN
     -- SET NOCOUNT ON added to prevent extra result sets from
     -- interfering with SELECT statements.
     SET NOCOUNT ON;

   -- Insert statements for procedure here
           INSERT INTO TOD_email (user_email, entry_date)
           VALUES (@p_user_email, @p_entry_date)
END
go

exec dbo.email_input '[email protected]', '7/19/2010'

Random Solutions  
 
programming4us programming4us