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 |
subysri
Starting Member
2 Posts |
Posted - 2010-06-03 : 01:47:15
|
Hi,In my table I have 2 columns ID and DEPT(Composite Keys). ID is an auto incremented column. I need the ID value to increment based on the DEPT column.Say, I have 2 DEPT values as XXX and YYY. So when incrementing the ID value, it should start from 1 to n for XXX and similarly 1 to n for YYY.Is it possible to handle this in the table level itself instead of quering in the code for max value based on the DEPT.Thanks,Subha |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
subysri
Starting Member
2 Posts |
Posted - 2010-06-03 : 02:08:05
|
Please let me know how this can be acheived using ROW_NUMBER function.Thanks,Subha |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|