• Hi Sigal,

    Actually the only purpose to use cursor is to avoid DBO, SYS, INFORMATION_SCHEMA and Guest users, else we can directly execute sp_helpuser and it will return all user's role data.

    To avoid cursor, while creating #tmpuser table, we can add another field with identity column and then run a while loop.

    We have to run a loop to get roles of each user excluding system users.

    your comments are appreciated.

    Thanks

    Sudhir