Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Checking for DB table existence using DBI/DBD

by JamesNC (Chaplain)
on Oct 14, 2005 at 11:47 UTC ( #500208=note: print w/replies, xml ) Need Help??


in reply to Checking for DB table existence using DBI/DBD

Learn about EXISTS ( you need to know it so you can do an update/insert statement in the same pass anyway ) On MSSQL/Sybase I would do something like:
IF EXISTS ( SELECT 1 FROM sysobjects where name = 'some_table' and typ +e = 'U' ) -- do this if true ( maybe an update here ) SELECT 1 ELSE -- do this if false ( maybe an insert here ) SELECT 0
You need to consult the docs as to how your database implements EXISTS which normally operates on a subquery and returns a boolean.
JamesNC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://500208]
help
Chatterbox?
[Discipulus]: Ah! if so you must play with him not with us ;=)
[vrk]: Hope he gets better soon.
[Discipulus]: hdb sorry i profit; is known that a prime number is never a figurate one nor the sumattion of two adjacent figurates of the same order? like 3th triangular+3th tetrahedric
[Discipulus]: if known where i can read about the matter?
[choroba]: he's not really sick, we just got nobody to look after him today

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2017-04-27 07:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (501 votes). Check out past polls.