It works for the forst record
when I read it through a cursor it only works for the first record and then seems to bomb on the rest