Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Question on INSERT INTO with subquery without columns list and AutoInc field
Sat, May 24 2008 3:12 PMPermanent Link

"Raul"
Hi,

I'm in the process of trying out DBISAM and have run into a question that i
can't seem to find a solution for.

The test table i'm using has an AutoInc field that is also primary unique
index. I'm testing an insert with a subquery into this table and want DBISAM
to auto-populate the AutoInc field while i provide data for other fields
without having to specify column list.

Using regular insert i can specify value NULL for DBISAM to provide the
value (e.g. INSERT  INTO "testtable" VALUES (NULL,'value 1' ...) and all is
OK.

However when i do a subquery how do i get the NULL for the AutoInc Column?

What i'd like to would be as follows:

INSERT INTO "testtable"
SELECT * FROM "someothertable"

By including the column list and omitting the AutoInc field from it
everything works just fine. However in most cases i need to insert every
field (except autoinc one) and i would really prefer to not include them
all.

I tried to use following

INSERT INTO "testtable"
SELECT NULL,* FROM "someothertable"

but NULL does not appear to be allowed by DBISAM inthis context.

Any suggestions would be appreciated

Regards,
Raul

Sat, May 24 2008 3:45 PMPermanent Link

"Robert"

"Raul" <raul@raul.ca> wrote in message
news:909D6FA5-BD59-4A5C-8196-761589F104C8@news.elevatesoft.com...
>
> I tried to use following
>
> INSERT INTO "testtable"
> SELECT NULL,* FROM "someothertable"
>
> but NULL does not appear to be allowed by DBISAM inthis context.
>

select cast(null as integer), * from "someothertable"

robert

Sat, May 24 2008 4:22 PMPermanent Link

"Raul"
Thanks Robert!

"Robert" <ngsemail2005withoutthis@yahoo.com.ar> wrote in message
news:2185219D-031B-4F6C-9A81-2E29BFE36E67@news.elevatesoft.com...
>
> "Raul" <raul@raul.ca> wrote in message
> news:909D6FA5-BD59-4A5C-8196-761589F104C8@news.elevatesoft.com...
>>
>> I tried to use following
>>
>> INSERT INTO "testtable"
>> SELECT NULL,* FROM "someothertable"
>>
>> but NULL does not appear to be allowed by DBISAM inthis context.
>>
>
> select cast(null as integer), * from "someothertable"
>
> robert
>

Sat, May 24 2008 4:51 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Robert,

Are you *sure* that you don't want to be a Team Elevate contributor ?
You'll notice that I'm asking publicly so as to embarass you into saying
yes.  I mean, you already answer DBISAM SQL questions all of the time, and
they're usually better than my answers. Smiley

--
Tim Young
Elevate Software
www.elevatesoft.com

Sun, May 25 2008 11:21 AMPermanent Link

"Hüseyin Aliz"
Vote +1

"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> skrev i en
meddelelse news:B624A8D3-052A-46E3-8C27-012EA4D66A72@news.elevatesoft.com...
> Robert,
>
> Are you *sure* that you don't want to be a Team Elevate contributor ?
> You'll notice that I'm asking publicly so as to embarass you into saying
> yes.  I mean, you already answer DBISAM SQL questions all of the time, and
> they're usually better than my answers. Smiley
>
> --
> Tim Young
> Elevate Software
> www.elevatesoft.com
>

Sun, May 25 2008 11:38 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

+2 - even if he does like me and drops the tag when asking a question.

Roy Lambert
Mon, May 26 2008 8:17 AMPermanent Link

"Robert"

"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message
news:B624A8D3-052A-46E3-8C27-012EA4D66A72@news.elevatesoft.com...
> Robert,
>
> Are you *sure* that you don't want to be a Team Elevate contributor ?
> You'll notice that I'm asking publicly so as to embarass you into saying
> yes.  I mean, you already answer DBISAM SQL questions all of the time, and
> they're usually better than my answers. Smiley
>

Thanks for the vote of confidence. I'll keep on posing my questions and
trying to help others with theirs - that is the purpose of these groups -
but I'd rather keep it informal.

Robert


Mon, May 26 2008 11:20 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Robert,

<< Thanks for the vote of confidence. I'll keep on posing my questions and
trying to help others with theirs - that is the purpose of these groups -
but I'd rather keep it informal. >>

No problem.  If you change your mind, though, drop me an email.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image