Re: Stuck with INSERT syntax problem
I had been doing quite well migrating Access queries to XML over the last couple of days, but when I tried to do stuff with temporary tables for location hierarchy support I've become stuck with a simple syntax problem that is driving me nuts. Can anyone please show me the obvious error that I'm missing with the following cut-down code that is giving the error message "Incorrect syntax near the keyword INTO"?
<?xml version="1.0" ?>
<CustomReport menupath="BRMC" title="BRMC - Temp Table Debug" description="Syntax debug">
<SQL>
<Where keytype="Default">
CREATE TABLE #Locations (Location_Key CHAR(16) COLLATE Database_Default PRIMARY KEY, Parent_Key CHAR(16) COLLATE Database_Default)
INSERT INTO #Locations (Location_Key,Parent_Key)
SELECT
LOCATION.LOCATION_KEY, LOCATION.LOCATION_KEY
FROM
LOCATION
WHERE
LOCATION.LOCATION_KEY = 'SR000149000000Y2'
DROP TABLE #Locations
</Where>
</SQL>
</CustomReport>
Thanks, Keith