Forum

Forum breadcrumbs - You are here:ForumGeneral: Chit-chatError Running SQL
Please or Register to create posts and topics.

Error Running SQL

I am running Access 2010 and when I copy and paste the following, I get these errors.

-- List Persons with Blank Names in the Address List
-- (a fault that may occur in a GEDCOM import).
-- Drop the last NOT to see all other persons with addresses.
-- TomH 14 Dec 2009
CREATE VIEW blankname_in_addresslist AS;
SELECT Surname||', '||Given COLLATE NOCASE AS Person, Adr.Name COLLATE NOCASE AS AddressName,
Adr.Street1, Adr.Street2, Adr.City, Adr.State, Adr.Country, Adr.Phone1, Adr.Fax, Adr.Email
FROM NameTable AS Nam, AddressLinkTable AS Lnk, AddressTable AS Adr
WHERE Nam.OwnerID = Lnk.OwnerID AND Lnk.AddressID = Adr.AddressID
AND Adr.AddressType = 0 AND Adr.Name NOT LIKE '%_';

ERROR: Invalid SQL statement;expected 'DELETE', 'INSERT', 'SELECT', pr 'UPDATE'.

I also get a SYNTAX error on some of the queries. Am I doing something wrong?

Looks to me like the error is the ; at the end of the CREATE VIEW line. Everything is OK and it worked on my database, though it returned zero records in my case.