Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jay_sql
Starting Member
3 Posts |
Posted - 2009-01-31 : 17:50:54
|
| I got a table named tblAlerts. It has two columns viz., ALERTS, ROW_TEXT and has many rows in the table. The sample of few rows is shown belowALERTS ROW_TEXT------- --------1010748 Yes1010748 No1010748 N/A1010749 Yes1010749 No1010749 N/A1010751 Yes1010752 Yes1010752 No1010752 N/A1010753 Yes1010754 Yes1010754 No1010754 N/A1010755 Not OK1010755 N/A1010757 111111010757 222221010757 33333Now, I need to do sql manipulation and produce the table as below with three columns viz., ALERTS, ROW_TEXT and ROW_ID. Basically ROW_ID is evolved from ALERTS and it is just a sequence number relevant to ALERTS. As ALERTS 1010748 has three rows, so in the ROW_ID you have numbers 1,2,3.... similarly for ALERTS 1010753 has only one row, thus the ROW_ID has 1. For ALERTS 1010754 has four rows, thus the ROW_ID has 1,2,3,4.ALERTS ROW_TEXT ROW_ID----------- -------------- ----------1010748 Yes 11010748 No 21010748 N/A 31010749 Yes 11010749 No 21010749 N/A 31010751 Yes 11010752 Yes 11010752 No 21010752 N/A 31010753 Yes 11010754 Yes 11010754 No 21010754 N/A 31010754 None 41010755 Not OK 11010755 N/A 21010757 11111 11010757 22222 21010757 33333 3Thanks,Jay |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|
|
|