February 24, 2005 at 5:26 am
Hi all,
I got the following situation to be resolved, plz. help me,
I have a table with N1 column as primary key & autogenerated (Identity =Yes, identity seed=1, identity increament=1), we wanted to send the autogenerated number to frontend after the row being inserted into the table. so, I thought of using AFTER INSERT trigger with following SELECT,
Select @n1 = n1 from inserted a
it wokrs fine, now the problem is how to send the value back to ASP.NET?
is there any alternate method to achive this ?
February 24, 2005 at 5:42 am
I think you are doing the insert using a raw sql. Instead do the insert inside a stored procedure and return the scope identity.
I hope this solves your problem
Thanks,
Ganesh
February 24, 2005 at 5:43 am
That is not what triggers are ment to do !
You can return the latest identity-value using SCOPE_IDENTITY ! Check BOL.
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
February 24, 2005 at 6:25 am
thanks guys... SCOPE_IDENTITY worked out well !!!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply