I am then selecting rows by thier identity. In sequence.
I did have this running with a cursor, though this way was quicker.
I would just like to know if I can have the resultset displayed with an
identity column, with only a select statement.
I know in oracle this can be done, though not sure about SQL.
__________________________________________
Anthony Hand
DBA | Systems Integration
Aon Risk Services Australia Ltd
Ph: +61 2 9253 7516
Fax: +61 2 92537952
Mob: +61 415 877 988
"John Thomas"
<[Email Address Removed] To: <anthony.[Email Address Removed] "LazyDBA.com Discussion"
om> <[Email Address Removed]
cc:
28/07/2003 bcc:
12:28 PM Subject: RE: creating an identity column on the fly
Anthony,
I am just curious. What are you trying to achieve here?
John
-----Original Message-----
From: anthony.[Email Address Removed] [mailto:anthony.[Email Address Removed] Sunday, July 27, 2003 3:51 PM
To: LazyDBA.com Discussion
Subject: Re: creating an identity column on the fly
Just to clarify things, this is what I am doing at the moment;
SELECT IDENTITY(int, 1,1) AS ID_Num, Name
INTO #NewTable
FROM master.dbo.sysdatabases
SELECT * from #NewTable
Am I able to do the above in a single select statement?
__________________________________________
Anthony Hand
DBA | Systems Integration
Aon Risk Services Australia Ltd
Ph: +61 2 9253 7516
Fax: +61 2 92537952
Mob: +61 415 877 988
anthony.[Email Address Removed] on.com.au To: "LazyDBA.com
Discussion" <[Email Address Removed] cc:
28/07/2003 bcc:
08:42 AM Subject: creating an
incrimented column on the fly
Is there a way to create a column, in a select statement, which has an
identity.
At the moment, I am selecting from a table into a temp table and then
inserting and identity row.
Is it possible to do this in the select statement on the fly?
Thanks guys,
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed] REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page