Grass (4/13/2012)
The code I posted in my first post is in SQL Exexute Task from a SSIS package.
Fine, I got the code. Now, please post the correct DDL and some readily usable sample data against which I can check what is wrong with your code.
Do what Lynn said in his last post. As soon as it is done we can start looking for what's wrong with the code.