Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2002
    Location
    vizag
    Posts
    11

    Thumbs up Unanswered: stored procedures

    If Exists (Select * From sysobjects Where name = 'sp_adduser' And user_name(uid) = 'dbo')
    Drop Procedure dbo.sp_adduser
    Go

    Create Procedure sp_adduser
    @u_name varchar(50),
    @u_password varchar(12),
    @u_firstname varchar(50),
    @u_lastname varchar(50),
    @u_email varchar(50),
    @team varchar(50),
    @project varchar(50),
    @department varchar(50),
    @task varchar(50),
    @u_id int output
    As
    set nocount on
    if not exists(select u_id from t_user where u_name=@u_name)
    begin
    INSERT INTO t_user(u_name, u_password, u_firstname, u_lastname, u_email , team , project , department , task) VALUES (@u_name, @u_password, @u_firstname, @u_lastname, @u_email , @team , @project , @department , @task)
    select @u_id=@@identity
    end
    else
    select @u_id=-1
    return

    Go

    this is the stored procedure in ms sql ...
    can any one help me how to write stored procedures in my sql

  2. #2
    Join Date
    Jul 2002
    Posts
    55
    MySQL won't support stored procedures until version N (where N is an unknown number). The nearest thing you can get to an sp is storing the SQL in a table and selecting and executing it, but you won't get the performance/optimiser bonuses that you get with MS SQL.

Posting Permissions

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