The variable @PKSQL is not used, so just comment it out. Then the script works OK.
DECLARE @IXSQL NVARCHAR(4000) SET @PKSQL = ''
to
DECLARE @IXSQL NVARCHAR(4000) --SET @PKSQL = ''
Then it works fine. It saved me quite a lot of time
thanks
http://90.212.51.111 domain