Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: perl mysql - INSERT INTO, 157 columns

by graff (Chancellor)
on May 02, 2014 at 16:52 UTC ( #1084812=note: print w/ replies, xml ) Need Help??


in reply to Re^2: perl mysql - INSERT INTO, 157 columns
in thread perl mysql - INSERT INTO, 157 columns

Given that the OP specifically mentioned mysql, I would not have posted the approach using "describe" if it didn't work in mysql.

As for your alternative (for cases where "describe" doesn't work), I would hope that any type of database covered by DBD would at least support "select * from foo limit 1", and this would be a prudent usage for the task at hand, whether or not you actually need to execute the query in order to get field names.

(BTW, thanks for the reminder about $")


Comment on Re^3: perl mysql - INSERT INTO, 157 columns
Replies are listed 'Best First'.
Re^4: perl mysql - INSERT INTO, 157 columns
by choroba (Canon) on May 02, 2014 at 17:03 UTC
    any type of database covered by DBD would at least support "select * from foo limit 1"
    Unfortunately, MS SQL Server throws an error:
    Incorrect syntax near '1'

    What works, though, is

    SELECT TOP 1 * FROM table
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re^4: perl mysql - INSERT INTO, 157 columns
by gsiems (Chaplain) on May 02, 2014 at 18:17 UTC
    One would hope. However, last time I looked (v 11R2), Oracle still didn't support either limit or offset (you can fake it with rownum, but that's ugly).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1084812]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (13)
As of 2015-07-30 14:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls