What sticks out to me is you did not name the data type of @SQL when you declared it.
Greg
_________________________________________________________________________________________________
The glass is at one half capacity: nothing more, nothing less.