all groups > sql server clients > march 2007 >
You're in the

sql server clients

group:

Is there a way to have an dynamic identity column?


Is there a way to have an dynamic identity column? ThunderMusic
3/29/2007 10:08:08 AM
sql server clients:
Hi,
What I want to do is a Select on a table that adds a dynamic column like
let's say Select T.*, GetDate() From MyTable T; My example is not very
useful, but it's just so you get the point... Now, I want the select to
create a simili-identity column that will set an incrementing value to each
record so I can filter afterward like this :

Select T.*, <IdentityFunction> as id From MyTable T Where id between @min
and @max ORDER BY MyColumn;

The goal to this is to create a query for a data list with a page so I don't
have to skip records in order to obtain the ones I need... I Would like to
select only the ones I need...

Is it possible?

Thanks

Re: Is there a way to have an dynamic identity column? Andrew J. Kelly
3/29/2007 1:00:26 PM
What version are you using? There are plenty of examples available on
paging like this that you can find from a simple google search. If you are
using SQl2005 then have a looka t the ROW_ID() function.

--
Andrew J. Kelly SQL MVP

[quoted text, click to view]

AddThis Social Bookmark Button