freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: matthew.green AT datamartcomputing.com
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Proper query to create table
- Date: Mon, 23 Jul 2018 08:39:46 +0000
Hi Igor,
The table already exists error is a normal Sybase error. You'll get the same
from isql.
There are several ways around this, you could create a temporary stored
procedure with the create in or you could put the create statement in a
variable and use execute immediate.
Cheers,
Matt.
July 22, 2018 8:58 AM, "Igor Korot" <ikorot01 AT gmail.com> wrote:
> 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.
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> https://lists.ibiblio.org/mailman/listinfo/freetds
-
[freetds] Proper query to create table,
Igor Korot, 07/22/2018
- Re: [freetds] Proper query to create table, matthew . green, 07/23/2018
-
Re: [freetds] Proper query to create table,
Frediano Ziglio, 07/23/2018
-
Re: [freetds] Proper query to create table,
Igor Korot, 07/23/2018
- Re: [freetds] Proper query to create table, Igor Korot, 07/23/2018
-
Re: [freetds] Proper query to create table,
matthew . green, 07/23/2018
- Re: [freetds] Proper query to create table, Igor Korot, 07/23/2018
-
Re: [freetds] Proper query to create table,
matthew . green, 07/23/2018
-
Re: [freetds] Proper query to create table,
Igor Korot, 07/23/2018
- Re: [freetds] Proper query to create table, Igor Korot, 07/24/2018
-
Re: [freetds] Proper query to create table,
matthew . green, 07/25/2018
- Re: [freetds] Proper query to create table, Igor Korot, 07/25/2018
-
Re: [freetds] Proper query to create table,
Igor Korot, 07/23/2018
-
Re: [freetds] Proper query to create table,
Igor Korot, 07/23/2018
Archive powered by MHonArc 2.6.24.