Quantcast
Channel: Questions in topic: "sql-server-2005"
Viewing all articles
Browse latest Browse all 415

most efficent way to flag records in sql 2005

$
0
0
I need a way to flag 3 records per segmentcode with a mtgflag = 1. If a segmentcode on a record does not have a mtgflag = 1, then flag any other record for that segmentcode randomly. Ex: I have 4 segmentcodes: CB_01, CB_02, CB_03 and CB_04. CB_01 and CB_03 have mtgflag = 1 but CB_02 and CB_04 do not. What needs to be flagged is CB_01 and CB_03 first and then either CB_02 or CB_04 random for a total of 3 records flagged. I have attached a script to build and add table and my script but it doesn't totally work. Thanks![link text][1] [1]: /storage/temp/1029-heqflagging.txt

Viewing all articles
Browse latest Browse all 415

Trending Articles