set i 0 foreach id $list_of_ids { lappend list_of_bind_ids :id_$i set id_$i $id incr i } set list_of_bind_ids [join $list_of_bind_ids ,]