Click here to Skip to main content
15,913,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all experts,
i have data like this:
A 1
B 2
C 3
D 4
E 5
F 6
I 7
Note:
A,B,C,D,E.. is one field of table1 and 1,2,3.... is not field

How can i display 2 columns and the same format like above?

Thanks

TONY
Posted

1 solution

In your second Column query you can put

(ROW_NUMBER() OVER(ORDER BY [first column name]))

like: insert into EMP values (1,ROW_NUMBER() OVER(ORDER BY [first column name]))
 
Share this answer
 
Comments
soeun tony 2-Aug-12 5:14am    
Hi Kamalakanta Nayak
Can Row_Number() use without Over(Order by[field])?

Thanks

TONY
Kamalkant(kk) 2-Aug-12 5:30am    
no yaar
Kamalkant(kk) 2-Aug-12 5:32am    
or u can set the identity property for that column like :
create table emp
(column1 varchar(20),
column2 int identity(1,1))
in table creation time

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900