Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 How to Generate & Insert a Autogenerated SlNo (Non Primary k

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-05-23 : 09:00:47
Jeyakumar writes "Dear Team,

I am using SQL Server 2005 version. I need to Get the running Sl.No from the Table (Which is not a primary key in that table).
Incase of SCOPE_IDENTITY() , i hope it works with Unique ID (PK).

In my case , Primary key is a different one. But at the same time i want to keep incrementing the SlNo for every new row inertion from my Application program using ASP.NET.

Pls help me in this.

Thanks.

Regards,

Jeyakumar.S
jeyakumar.vs@gmail.com"

JBelthoff
Posting Yak Master

173 Posts

Posted - 2006-05-23 : 11:14:56
Can't you do it like this..?

Declare @siNum int


After your insert...

Select @siNum = SCOPE_IDENTITY()

--Then
Select Sl.No from YourTable
Where PK = @siNum


JBelthoff
D
odge, Duck, Dip, Dive & Dodge
If a man can dodge a wrench, he can dodge a ball!
Asp Hoting Provider
Go to Top of Page
   

- Advertisement -