Results 1 to 4 of 4
  1. #1

    Default Help on this stored procedure


    Peeps, plz help

    ALTER PROCEDURE dbo.AddItemRecord
    (
    @id int = NULL,
    @description int = NULL,
    )
    AS

    SELECT COUNT(*) AS idnumber FROM ITEM;

    INSERT INTO Item
    (id, description)
    VALUES (@id,@description)


    unsaon nako pagset na kanang resulta na idnumber, mabutang sa id na variable. Thanks

  2. #2
    Junior Member
    Join Date
    May 2007
    Gender
    Male
    Posts
    322

    Default Re: Help on this stored procedure

    Try this one bro:

    Code:
    ALTER PROCEDURE dbo.AddItemRecord
    (
    @id int = NULL,
    @description int = NULL
    )
    AS
    
    SELECT @id = COUNT(*) FROM ITEM;
    
    INSERT INTO Item
                 (id, description)
    VALUES    (@id,@description)
    I just notice na you update you @id variable from within the Script, I suggest not to declare @id as parameter of SP but rather a variable within the script like:

    Code:
    ALTER PROCEDURE dbo.AddItemRecord
    (
      @description int = NULL
    )
    AS
    
    Declare @id int;
    
    SELECT @id = COUNT(*) FROM ITEM;
    
    INSERT INTO Item (id, description)
    VALUES (@id,@description)

  3. #3

    Default Re: Help on this stored procedure

    Thanks bro

  4. #4
    Junior Member
    Join Date
    May 2007
    Gender
    Male
    Posts
    322

    Default Re: Help on this stored procedure

    No problem :mrgreen:, glad that I could help.

  5.    Advertisement

Similar Threads

 
  1. i hope im on the right thread,i need some help on this...
    By jemar in forum Software & Games (Old)
    Replies: 2
    Last Post: 05-05-2010, 03:40 PM
  2. Need help on this problem
    By RedbaroN in forum Computer Hardware
    Replies: 3
    Last Post: 02-04-2010, 10:20 AM
  3. urgent: need help on this bit
    By etzina in forum Programming
    Replies: 1
    Last Post: 08-06-2009, 06:06 PM
  4. Help on this annoying virus!!
    By prukutung in forum Software & Games (Old)
    Replies: 6
    Last Post: 07-14-2009, 03:43 PM
  5. need your opinion on this...help
    By angelofdeath in forum "Love is..."
    Replies: 13
    Last Post: 09-03-2007, 11:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top