• You can get rid of the need for the cursor

    SELECT @r=@R+column_name+',' from INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE where constraint_name =@uq_name

    G