Without seeing the actual code that does the work, it's impossible to know if there is
something wrong with it.
As you said, running the query within EM works fine, so one could assume the SQL script is
working fine, but that's the only thing that you posted
Rodrigo Gómez [NDX]