Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to get the value of ID columns from older tables?

Reply
Thread Tools

How to get the value of ID columns from older tables?

 
 
JB
Guest
Posts: n/a
 
      02-20-2010
Hello Community

I have several SQL Server tables with ID columns (the property of the
columns specify that it "Is Identity Yes").

The tables have many rows but I only want the value of the ID column
from a table when the where clause is satisfied.

These are "not" newly inserted in fact these rows can be very old and deep
within the table.

Can anyone tell me how I can extract the value from an Identity column from
a table?

Thanks
Jeff


 
Reply With Quote
 
 
 
 
Mr. Arnold
Guest
Posts: n/a
 
      02-20-2010
JB wrote:
> Hello Community
>
> I have several SQL Server tables with ID columns (the property of the
> columns specify that it "Is Identity Yes").
>
> The tables have many rows but I only want the value of the ID column
> from a table when the where clause is satisfied.
>
> These are "not" newly inserted in fact these rows can be very old and deep
> within the table.
>
> Can anyone tell me how I can extract the value from an Identity column from
> a table?
>
> Thanks
> Jeff
>
>


You use T-SQL Select statement to select the row like anything else
selected from the table row.

If ID is an Identity field on a table, then it is this.

select ID from table where somefield = parm.

You would only get the resultset back of ID only.

You can then read the resultset using a datareader to access ID in the
resultset.
 
Reply With Quote
 
 
 
 
JB
Guest
Posts: n/a
 
      02-22-2010
Thank you Mr Arnold

I also saw that there is a keyword named IDENTITYCOL which I can use in
the select statement to capture the IDENTITY.
--
JB


"Mr. Arnold" wrote:

> JB wrote:
> > Hello Community
> >
> > I have several SQL Server tables with ID columns (the property of the
> > columns specify that it "Is Identity Yes").
> >
> > The tables have many rows but I only want the value of the ID column
> > from a table when the where clause is satisfied.
> >
> > These are "not" newly inserted in fact these rows can be very old and deep
> > within the table.
> >
> > Can anyone tell me how I can extract the value from an Identity column from
> > a table?
> >
> > Thanks
> > Jeff
> >
> >

>
> You use T-SQL Select statement to select the row like anything else
> selected from the table row.
>
> If ID is an Identity field on a table, then it is this.
>
> select ID from table where somefield = parm.
>
> You would only get the resultset back of ID only.
>
> You can then read the resultset using a datareader to access ID in the
> resultset.
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Read CSV - string Columns - Int columns =?Utf-8?B?YmVub2l0?= ASP .Net 0 05-08-2006 02:11 PM
database columns vs. gui columns and sorting ittay.dror@gmail.com Java 5 03-04-2006 10:48 AM
CSS columns problem - faux columns don't work henrybranson@hotmail.com HTML 4 11-24-2005 10:05 AM
convert rows to columns and columns to rows helpful sql ASP .Net 0 05-19-2005 06:03 PM



Advertisments