www.webdeveloper.com
Results 1 to 5 of 5

Thread: CREATE PROCEDURE Error

  1. #1
    Join Date
    Sep 2010
    Posts
    68

    CREATE PROCEDURE Error

    I am getting a error in the opening 3 lines:

    CREATE P*****
    Here is my code:

    Code:
    CREATE PROCEDURE [sql1] (@Latin int(4)) 
    AS
    DECLARE @max int(4), @min int(4), @col3 int(4),@datetime datetime(8);
    Thanks in advance.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,604
    What DBMS are you using?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Sep 2010
    Posts
    68
    Quote Originally Posted by NogDog View Post
    What DBMS are you using?
    1and1 MS SQL

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,604
    ooh...I only have access to MySQL and PostgreSQL, so can't really try it myself.

    I'm pretty sure you don't want those square brackets around the procedure name, however?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,136
    the code you have in the thread here is incomplete...here is a full example of a stored procedure, which takes 2 parameters (you can add/remove them at will), just follow the syntax
    Code:
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    
    CREATE PROCEDURE proc_myStoredProcName(@variable1 varchar(20),@variable2 int) 
    	
    AS
    BEGIN
    	-- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements. u can comment it or delete it if not needed
    	SET NOCOUNT ON;
    	--your select,update,insert statement below
    	SELECT id,user_id,login_time FROM somedatabasename.dbo.user_activity WHERE login_time='this works'
    END
    GO
    Hope this helps..:-)
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles