Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > identifiy Identity field's value within query
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 17th August 17:15
farhan iqbal
External User
 
Posts: 1
Default identifiy Identity field's value within query



hi all

Is there any way to identifiy Identity field's value within query?

Farhan Iqbal
  Reply With Quote


  sponsored links


2 17th August 17:16
andy svendsen
External User
 
Posts: 1
Default identifiy Identity field's value within query



I assume you mean how do you find out what the current value is. You can
query the field just like any other. There are probably a lot of ways to do
this.

The way I thought right off the top of my head is

select max(<column name of Identity field>) from <tablename>

The highest value is the current value.

However, a quick check to SQL Books online reveals

dbcc checkident (<tablename>)

will also get you what you need.
--
************************************************** *****************
Andy S.
MCSE NT/2000, MCDBA SQL 7/2000
andymcdba1@NOMORESPAM.yahoo.com

Please remove NOMORESPAM before replying.

Always keep your antivirus and Microsoft software
up to date with the latest definitions and product updates.
Be suspicious of every email attachment, I will never send
or post anything other than the text of a http:// link nor
post the link directly to a file for downloading.


************************************************** *****************
  Reply With Quote
3 28th August 18:22
hari prasad
External User
 
Posts: 1
Default identifiy Identity field's value within query


Hi,

Use the below function in your select statement,

IDENT_SEED ( 'table_or_view' )

Thanks
Hari
MCDBA
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666