in reply to DBI SQL error messages

Although you haven't offered any details, "line 1" in the error message suggests to me that your SQL is being generated dynamically. Nothing wrong with that, in fact that's usually the whole point of having programs interact with databases. But my strategic advice to anyone starting out with DBI is to pratice first with a simple static SQL statement, your database's equivalent of print 'Hello, world!'.

Run a query through the MSAccess GUI, then view the underlying SQL and copy that into your Perl program. Get a feel for how DBI works by successfully doing something simple before you move back to the problem that prompted this post.

Then go the other way. Have your Perl program print out your SQL just before it executes it. Paste the printed out SQL back into the SQL view of the MSAccess query designer.

By all means come back to Perlmonks with questions about your results, and when you do, post some code.

Good luck!

Replies are listed 'Best First'.
Re^2: DBI SQL error messages
by rjberry (Novice) on Oct 06, 2008 at 09:14 UTC

    Thanks, you're right, I was just hoping there'd be an easier way to do it from Perl itself, if you see what I mean? Having to open Access every time is a pain (esp. as I'm not very familiar with it). Looks like that's the only error message I'll get from Perl though.

    I tried writing the query into Access normally and it changes it into something bizarre:

    INSERT INTO tblCustomer ( LastName, BranchID, FirstName, Premise, Street, District, Town, County, PostCode ) SELECT 'a' AS Expr1, 'b' AS Expr2, 'c' AS Expr3, 'd' AS Expr4, 'e' AS Expr5, 'f' AS Expr6, 'g' AS Expr7, 'h' AS Expr8, 'i' AS Expr9;

    The select thing seems slightly ridiculous. I wonder if that's just because the way the GUI works or whether Access databases themselves don't understand Values().

    But anyway, that works. Thanks for your help.

      I wonder if that's just because the way the GUI works

      That's right. If you bypass the GUI (what Access calls Design View), you can run an INSERT ... VALUES statement against an Access database, just as DBI does.

      Ask the GUI to display what you just did, and it converts the VALUES list to a SELECT clause without a FROM clause. If you don't want to see this happen, stay in SQL view.

        Hiya, I've found out what it is actually. There's nothing wrong with my SQL, it's instead to do with how MSAccess treats its version of Text fields, which is Memo fields. For some reason it's not really compatible with DBI. There's a post about it here, although their fix didn't work for me, sadly.