• thanks for your feedback steve.

    this script is a modified version of another script which i wrote.that script was embedded in vbscript and it was supposed to be run on all servers.but by doing this we dont have enough control on it.and my TL suggested to replace cursor.

    i was thinking of set-based solution.but as it is DIWALI festival i will complete it after its over.

    and as for xp_cmdshell and ole i assumed that everyone knows about it.

    and stored procedure is useful if its permanent and then we can just pass values but as this is a one time script which doesnt create any permanent objects i never thought of creating a procedure for that.

    last but not least

    thanks for appreciating my work and taking efforts to see it works and needs improvements and

    it can be useful to DBA's.