Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > SQL SERVER (TECHNET) > Identity or Sequence column in non-table SELECT
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 25th July 07:16
hari prasad
External User
 
Posts: 1
Default Identity or Sequence column in non-table SELECT



Hi,


There is no concept of Rownum in sql server.


But you could write ur own query to get the serial number.


Use the below script as sample:-


create table item(item_code varchar(05))
go
insert into item values('a1')
insert into item values('a2')
insert into item values('a3')
insert into item values('a4')
go


SELECT (SELECT COUNT(i.item_code)
FROM item i
WHERE i.item_code >= o.item_code ) AS RowID,
item_code
FROM item o
ORDER BY RowID


Note:

This aproach is not recommended on a huge table. This query takes long time
and take more resource.

Thanks
Hari
SQL Server MVP
  Reply With Quote


  sponsored links


2 25th July 07:16
hugo kornelis
External User
 
Posts: 1
Default Identity or Sequence column in non-table SELECT



Hi Glenn,

http://www.aspfaq.com/show.asp?id=2427

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




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