I need help in generating a unique key for 3 columns in a view. For example : I have a view that returns those columns: f1 f2 f3 111 222 333 111 222 333 aaa bbb ccc aaa bbb ddd aaa bbb ccc 111 222 333
I want to add another field that will be a unique key for those 3 fields, like that : key f1 f2 f3 1 111 222 333 1 111 222 333 2 aaa bbb ccc 3 aaa bbb ddd 2 aaa bbb ccc 1 111 222 333
select a.seq, b.* from ( select distinct f1.f2,f3 seq = row_number() from tbl ) a join tbl b on a.f1 = b.f1 and a.f2 = b.f2 and a.f3 = b.f3
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy.