SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast nkacharani's Avatar
    Join Date
    Oct 2010
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face procedure add data in MS SQL

    hi all,

    can someone assist what am I doing wrong!..
    I have two tables shop and shop_owner I want to have a procedure which will be adding shops to the mall(if owner open a new shop)

    Code:
    CREATE PROCEDURE  update_mall
    
    AS
    BEGIN
    declare @man  varchar(30);
    select * from shop_owner where owner_Id = 'MAN001' //assuming MAN001 is the ID admin enter in search box
    set @man = 'MAN001'
    
    if(@man= 'MAN001')
    begin
    insert into shop (owner_Id,shop_name,shop_location) values
    ('MAN001','Shine and smile','Kariakoo');
    end
    END
    thanks

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,340
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    what you're doing wrong is not telling us how you know that what you're doing is wrong

    what happens when you run that procedure? does it crash? return the wrong data? produce an error message?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast nkacharani's Avatar
    Join Date
    Oct 2010
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    what you're doing wrong is not telling us how you know that what you're doing is wrong

    what happens when you run that procedure? does it crash? return the wrong data? produce an error message?
    lol!..I do not see the insert part working(if I select all in the shop table no data is added) though the query execute successful

    thanks

  4. #4
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Procedural language is the concluding part of sql oracle and it is very beneficial when storing a value into the database, moreover its secured and safe to keep it safe.

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,340
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by timu123 View Post
    Procedural language is the concluding part of sql oracle and it is very beneficial when storing a value into the database, moreover its secured and safe to keep it safe.
    looks like english, sounds like english, but what the heck does it mean?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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