TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ToBe
NA
164
94.4k
using the method output inserted.id
Jun 2 2013 7:44 AM
hi everyone
i have 3 stored procedures one is the main sp i'm using the method
output inserted.id
in the insertion Stored Procedure
like this :
ALTER PROCEDURE [dbo].[sp_INSERT_REG_DETAILS]
@SER_NO NVARCHAR (50),
@REG_DATE DATE,
@NAME Varchar(50),
@RPF NVARCHAR (50),
@ADDRESS VARCHAR(250),
@COLG VARCHAR(50),
@USR INT
AS
Set NoCount On
Begin
Insert into REG_DETAILS
(
Ser_no,Reg_date,Name,Prf,Address,Golg,User
)
output inserted.ID
Values
(
@SER_NO,@REG_DATE,@NAME,@RPF,@ADDRESS,@COLG,@USR
)
End
Second stored procedure:
ALTER PROCEDURE [dbo].[sp_INSERT_TYPE]
@ID int
@TYPE varchar (50)
AS
BEGIN
SET NOCOUNT ON;
Insert into [dbo].[TYPE]
(ID,TYPE)values(@ID,@TYPE)
END
Third stored procedure :
ALTER PROCEDURE [dbo].[sp_Insert_ST]
@ID int
@ST varchar (50)= NULL
AS
BEGIN
SET NOCOUNT ON;
Insert into tblST
(ID,stu)values(@ID,@STU)
END
when I put it in my update stored procedure it will give syntax error where to put it in the update stored procedure ? after the values ? before the last statment GO or what should i do ?
Reply
Answers (
4
)
IS Primary Key Always Better ?
STORED PROCEDURE