Avoid Cursor and In when you developing query it reduce the performance when you retrieve the large no of records use inner join to do like in Sql Server .