in reply to Memory Leak
Just guessing... since I don't use Windows - maybe you should init
my $sqlsrv=Win32::SqlServer::sql_init('*Deleted*','*Params*','*For +*','*Security*'); [download]
only once, and initialize $sqlsrv in the surrounding scope.