Link to home
Start Free TrialLog in
Avatar of arthrex
arthrexFlag for Germany

asked on

SELECT @newLinkId = Link_Id FROM inserted what to use for "inserted"?

hello experts,

the line "SELECT @newLinkId = Link_Id FROM inserted" is wrong.
Please tell me what to use instead of inserted.
Thanks a lot!

CREATE PROCEDURE [dbo].[Linksummary_CreateNewLink]

  @Linkname nvarchar(50),
  @Linkdescr nvarchar(100),
  @Linkurl nvarchar(500),
  @CategoryId int

AS
INSERT Link
      (
            Link_Name,
            Link_Descr,
            Link_Url
      )
      VALUES
      (
            @Linkname,
            @Linkdescr,
            @Linkurl
      )

      DECLARE @newLinkId int
      SELECT @newLinkId = Link_Id FROM inserted

      INSERT Category_Link
      (
            Category_Id,
            Link_Id
      )
      VALUES
      (
            @CategoryId,
            @newLinkId

      )
RETURN @@IDENTITY
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arthrex

ASKER

No i'm not allowed :-) but I didn't know better... so I just wort it like that to explain my problem better...
Thanks! @@identity worked... too easy to imagine..