Proper query to create table
Igor Korot <[email protected]> Sat, 21 Jul 2018 23:57:59 -0700
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <CA+FnnTz6K5dNNJkS4A6F+0DP-8Ryc8AxtypkEg7R0o3+rtba3Q@mail.gmail.com> |
Hi, ALL,
I'm trying to execute following query:
query1 = L"IF NOT EXISTS(SELECT 1 FROM sysobjects WHERE name =
'abcatcol' AND type = 'U') CREATE TABLE abcatcol( <field_list>))";
Unfortunately it fails.
If the table does not exist I'm getting 100 (SQL_NO_DATA) from the ODBC
driver.
And if the table does exist, I'm getting -1 with the error:
"The table already exists".
Is there a way to do this in 1 shot? Or I will have to do a conditional
for Sybase to make it in 2 queries?
Please advise.
Thank you.