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
Rajkumar R
NA
183
220k
How to increment Row value(Running Number) in sql server
Feb 9 2012 1:04 AM
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
ALTER TRIGGER [PIP_ENTRYINSERT] ON dbo.PIP_Entry
AFTER INSERT AS
UPDATE PIP_ENTRY SET pipcode = (SELECT 'PIP'++CONVERT(VARCHAR,MAX(pipcode1)+1) FROM PIP_ENTRY) where pipcode =''
UPDATE PIP_ENTRY SET pipcode1 = (SELECT MAX(pipcode1)+1 FROM PIP_ENTRY) where pipcode1 = 0
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
The Above trigger i have used to increment row value when ever data is inserted (ie., After insert trigger). Here i have a problem when i use this trigger in web application. The actual problem is number of user's inserting data at same time then it is not working it is not able to generate running number for all the users. Because this trigger works like row-identity.
So i need solution for this post.
Thanks in advance
Reply
Answers (
1
)
Partial Functional Dependancy in SQL SERVER
SQL statement for getting all columns of table