Discussion:
select into limitations
(too old to reply)
unknown
2009-12-02 04:02:25 UTC
Permalink
Hi all,
This is for ASE 15.0.3, I am not sure if it is a bug or I am
missing something.
I was trying to "select into" into a tempdb table and
everytime only 500 rows were affected. Actually it should be
1212 rows.
Not knowing what is causing this,
I split my where condition restricting 400 records each time
so making three queries rather than one, then finally I
ended up creating 3 tables by running 3 select into queries.
I later did a bcp out of the other two tables into one
table.
My question is, why did not just "select only" took care of
it?
I am sure it has nothing to do with partition as there is
only one partition i.e. the default one.
Any ideas?

Thanks and Best Regards
Mark A. Parsons
2009-12-02 04:24:00 UTC
Permalink
What happens if you remove the INTO clause and re-run the SELECT? Do you get 500 or 1212 rows in the result set? If
you get 500 ... a couple possibilities come to mind ...

- you've issued a 'set rowcount 500' command at some point (perhaps in a login trigger?)

- the SELECT references a view which contains a 'top 500' clause in the view's SELECT list

----------------------

FWIW, you can check a spid's current 'set rowcount XXXX' setting via the following:

======================
dbcc traceon(3604)
go
dbcc pss(0,<spid>,0)
go
======================

In the resulting output you want to look for the value assigned to the 'prowcnt' variable.

For example, after running 'set rowcount 98765' I run 'dbcc pss(0,@@spid,0)' and find:

======================
... snip ...

prowcnt=98765 pcurcmd=317 (DBCC_CMD)
pstatlist=0x0 pseqstat=16 (0x0010 (SEQ_REPSPROC_CHECKED))

... snip ...
======================
Post by unknown
Hi all,
This is for ASE 15.0.3, I am not sure if it is a bug or I am
missing something.
I was trying to "select into" into a tempdb table and
everytime only 500 rows were affected. Actually it should be
1212 rows.
Not knowing what is causing this,
I split my where condition restricting 400 records each time
so making three queries rather than one, then finally I
ended up creating 3 tables by running 3 select into queries.
I later did a bcp out of the other two tables into one
table.
My question is, why did not just "select only" took care of
it?
I am sure it has nothing to do with partition as there is
only one partition i.e. the default one.
Any ideas?
Thanks and Best Regards
unknown
2009-12-02 06:22:27 UTC
Permalink
Hi Mark,
If we do a select or select count(*) result is 1212.
Only when the same query is changed to a "select into"
referencing the same table (everything remains the same,
there is no view), the affected rows change to 500.
There are no login triggers and since the select query works
fine, there shouldn't be any problem with rowcount.
It was never set.

select * from x.y.z
where sequence_num in (.............) --numbers 1216
returns 1212 records

select * into tempdb..z from x.y.z
where sequence_num in (.............) --numbers 1216
returns 500 records


Regards
Humayun Manzer
Post by Mark A. Parsons
What happens if you remove the INTO clause and re-run the
SELECT? Do you get 500 or 1212 rows in the result set?
If you get 500 ... a couple possibilities come to mind
...
- you've issued a 'set rowcount 500' command at some point
(perhaps in a login trigger?)
- the SELECT references a view which contains a 'top 500'
clause in the view's SELECT list
----------------------
FWIW, you can check a spid's current 'set rowcount XXXX'
======================
dbcc traceon(3604)
go
dbcc pss(0,<spid>,0)
go
======================
In the resulting output you want to look for the value
assigned to the 'prowcnt' variable.
For example, after running 'set rowcount 98765' I run
======================
... snip ...
prowcnt=98765 pcurcmd=317 (DBCC_CMD)
pstatlist=0x0 pseqstat=16 (0x0010
(SEQ_REPSPROC_CHECKED))
... snip ...
======================
Post by unknown
Hi all,
This is for ASE 15.0.3, I am not sure if it is a bug or
I am missing something.
I was trying to "select into" into a tempdb table and
everytime only 500 rows were affected. Actually it
should be 1212 rows.
Not knowing what is causing this,
I split my where condition restricting 400 records each
time so making three queries rather than one, then
finally I ended up creating 3 tables by running 3 select
into queries. I later did a bcp out of the other two
tables into one table.
My question is, why did not just "select only" took care
of it?
I am sure it has nothing to do with partition as there
is only one partition i.e. the default one.
Any ideas?
Thanks and Best Regards
Mark A. Parsons
2009-12-02 06:59:37 UTC
Permalink
In your sample queries you have a comment ... "--numbers 1216" ... what does this mean? Does this mean you have 1216
different entries in the 'in ()' clause?

Are you using isql? If not, do you get the same limitation (500 records) when using isql? [just a stab in the dark;
want to rule out any issues with the front-end application, especially if the 'in()' clause is quite large]

Do you see this same limitation (500 records) for SELECT/INTOs for other source tables?

Do you see this same limitation (500 records) if you run the SELECT/INTO against the same source table (x.y.z) but with
a different where clause? For example, replace the 'in()' clause with a 'between' clause known to return more than 500
records. Another example, remove the 'in()' clause, preface the query with 'set rowcount XXX' (where XXX > 500), and
run the query. [assuming a large 'in()' clause list ... wondering about a problem with how the dataserver is
handling/processing said 'in()' clause list]

Assuming the 'in()' clause is quite large (eg, 1216 values), what happens if you place the 'in()' clause values in a
table and drive your query with a join to said table? [again, wondering if there's a bug in the dataserver when working
with a large 'in()' clause]
Post by unknown
Hi Mark,
If we do a select or select count(*) result is 1212.
Only when the same query is changed to a "select into"
referencing the same table (everything remains the same,
there is no view), the affected rows change to 500.
There are no login triggers and since the select query works
fine, there shouldn't be any problem with rowcount.
It was never set.
select * from x.y.z
where sequence_num in (.............) --numbers 1216
returns 1212 records
select * into tempdb..z from x.y.z
where sequence_num in (.............) --numbers 1216
returns 500 records
Regards
Humayun Manzer
Post by Mark A. Parsons
What happens if you remove the INTO clause and re-run the
SELECT? Do you get 500 or 1212 rows in the result set?
If you get 500 ... a couple possibilities come to mind
...
- you've issued a 'set rowcount 500' command at some point
(perhaps in a login trigger?)
- the SELECT references a view which contains a 'top 500'
clause in the view's SELECT list
----------------------
FWIW, you can check a spid's current 'set rowcount XXXX'
======================
dbcc traceon(3604)
go
dbcc pss(0,<spid>,0)
go
======================
In the resulting output you want to look for the value
assigned to the 'prowcnt' variable.
For example, after running 'set rowcount 98765' I run
======================
... snip ...
prowcnt=98765 pcurcmd=317 (DBCC_CMD)
pstatlist=0x0 pseqstat=16 (0x0010
(SEQ_REPSPROC_CHECKED))
... snip ...
======================
Post by unknown
Hi all,
This is for ASE 15.0.3, I am not sure if it is a bug or
I am missing something.
I was trying to "select into" into a tempdb table and
everytime only 500 rows were affected. Actually it
should be 1212 rows.
Not knowing what is causing this,
I split my where condition restricting 400 records each
time so making three queries rather than one, then
finally I ended up creating 3 tables by running 3 select
into queries. I later did a bcp out of the other two
tables into one table.
My question is, why did not just "select only" took care
of it?
I am sure it has nothing to do with partition as there
is only one partition i.e. the default one.
Any ideas?
Thanks and Best Regards
unknown
2009-12-02 07:49:13 UTC
Permalink
Yes, I have 1216 distinct values in the in clause.
I have just tried with isql and it seems to be working fine.
Previously I used interactive sql.
Thanks a lot for your replies.
Post by Mark A. Parsons
In your sample queries you have a comment ... "--numbers
1216" ... what does this mean? Does this mean you have
1216 different entries in the 'in ()' clause?
Are you using isql? If not, do you get the same
limitation (500 records) when using isql? [just a stab in
the dark; want to rule out any issues with the front-end
application, especially if the 'in()' clause is quite
large]
Do you see this same limitation (500 records) for
SELECT/INTOs for other source tables?
Do you see this same limitation (500 records) if you run
the SELECT/INTO against the same source table (x.y.z) but
with a different where clause? For example, replace the
'in()' clause with a 'between' clause known to return more
than 500 records. Another example, remove the 'in()'
clause, preface the query with 'set rowcount XXX' (where
XXX > 500), and run the query. [assuming a large 'in()'
clause list ... wondering about a problem with how the
dataserver is handling/processing said 'in()' clause
list]
Assuming the 'in()' clause is quite large (eg, 1216
values), what happens if you place the 'in()' clause
values in a table and drive your query with a join to
said table? [again, wondering if there's a bug in the
dataserver when working with a large 'in()' clause]
Post by unknown
Hi Mark,
If we do a select or select count(*) result is 1212.
Only when the same query is changed to a "select into"
referencing the same table (everything remains the same,
there is no view), the affected rows change to 500.
There are no login triggers and since the select query
works fine, there shouldn't be any problem with
rowcount. It was never set.
select * from x.y.z
where sequence_num in (.............) --numbers 1216
returns 1212 records
select * into tempdb..z from x.y.z
where sequence_num in (.............) --numbers 1216
returns 500 records
Regards
Humayun Manzer
Post by Mark A. Parsons
What happens if you remove the INTO clause and re-run
the >> SELECT? Do you get 500 or 1212 rows in the result
set? >> If you get 500 ... a couple possibilities come to
mind >> ...
Post by unknown
Post by Mark A. Parsons
- you've issued a 'set rowcount 500' command at some
point >> (perhaps in a login trigger?)
Post by unknown
Post by Mark A. Parsons
- the SELECT references a view which contains a 'top
500' >> clause in the view's SELECT list
Post by unknown
Post by Mark A. Parsons
----------------------
FWIW, you can check a spid's current 'set rowcount
======================
dbcc traceon(3604)
go
dbcc pss(0,<spid>,0)
go
======================
In the resulting output you want to look for the value
assigned to the 'prowcnt' variable.
For example, after running 'set rowcount 98765' I run
======================
... snip ...
prowcnt=98765 pcurcmd=317 (DBCC_CMD)
pstatlist=0x0 pseqstat=16 (0x0010
(SEQ_REPSPROC_CHECKED))
... snip ...
======================
Post by unknown
Hi all,
This is for ASE 15.0.3, I am not sure if it is a bug
or >>> I am missing something.
Post by unknown
Post by Mark A. Parsons
Post by unknown
I was trying to "select into" into a tempdb table and
everytime only 500 rows were affected. Actually it
should be 1212 rows.
Not knowing what is causing this,
I split my where condition restricting 400 records
each >>> time so making three queries rather than one,
then >>> finally I ended up creating 3 tables by running 3
select >>> into queries. I later did a bcp out of the
other two >>> tables into one table.
Post by unknown
Post by Mark A. Parsons
Post by unknown
My question is, why did not just "select only" took
care >>> of it?
Post by unknown
Post by Mark A. Parsons
Post by unknown
I am sure it has nothing to do with partition as there
is only one partition i.e. the default one.
Any ideas?
Thanks and Best Regards
Sherlock, Kevin
2009-12-02 14:27:18 UTC
Permalink
Yes, dbisql has an option to limit your result set. Change that option to
"0".
Post by unknown
Yes, I have 1216 distinct values in the in clause.
I have just tried with isql and it seems to be working fine.
Previously I used interactive sql.
Thanks a lot for your replies.
Post by Mark A. Parsons
In your sample queries you have a comment ... "--numbers
1216" ... what does this mean? Does this mean you have
1216 different entries in the 'in ()' clause?
Are you using isql? If not, do you get the same
limitation (500 records) when using isql? [just a stab in
the dark; want to rule out any issues with the front-end
application, especially if the 'in()' clause is quite
large]
Do you see this same limitation (500 records) for
SELECT/INTOs for other source tables?
Do you see this same limitation (500 records) if you run
the SELECT/INTO against the same source table (x.y.z) but
with a different where clause? For example, replace the
'in()' clause with a 'between' clause known to return more
than 500 records. Another example, remove the 'in()'
clause, preface the query with 'set rowcount XXX' (where
XXX > 500), and run the query. [assuming a large 'in()'
clause list ... wondering about a problem with how the
dataserver is handling/processing said 'in()' clause
list]
Assuming the 'in()' clause is quite large (eg, 1216
values), what happens if you place the 'in()' clause
values in a table and drive your query with a join to
said table? [again, wondering if there's a bug in the
dataserver when working with a large 'in()' clause]
Post by unknown
Hi Mark,
If we do a select or select count(*) result is 1212.
Only when the same query is changed to a "select into"
referencing the same table (everything remains the same,
there is no view), the affected rows change to 500.
There are no login triggers and since the select query
works fine, there shouldn't be any problem with
rowcount. It was never set.
select * from x.y.z
where sequence_num in (.............) --numbers 1216
returns 1212 records
select * into tempdb..z from x.y.z
where sequence_num in (.............) --numbers 1216
returns 500 records
Regards
Humayun Manzer
Post by Mark A. Parsons
What happens if you remove the INTO clause and re-run
the >> SELECT? Do you get 500 or 1212 rows in the result
set? >> If you get 500 ... a couple possibilities come to
mind >> ...
Post by unknown
Post by Mark A. Parsons
- you've issued a 'set rowcount 500' command at some
point >> (perhaps in a login trigger?)
Post by unknown
Post by Mark A. Parsons
- the SELECT references a view which contains a 'top
500' >> clause in the view's SELECT list
Post by unknown
Post by Mark A. Parsons
----------------------
FWIW, you can check a spid's current 'set rowcount
======================
dbcc traceon(3604)
go
dbcc pss(0,<spid>,0)
go
======================
In the resulting output you want to look for the value
assigned to the 'prowcnt' variable.
For example, after running 'set rowcount 98765' I run
======================
... snip ...
prowcnt=98765 pcurcmd=317 (DBCC_CMD)
pstatlist=0x0 pseqstat=16 (0x0010
(SEQ_REPSPROC_CHECKED))
... snip ...
======================
Post by unknown
Hi all,
This is for ASE 15.0.3, I am not sure if it is a bug
or >>> I am missing something.
Post by unknown
Post by Mark A. Parsons
Post by unknown
I was trying to "select into" into a tempdb table and
everytime only 500 rows were affected. Actually it
should be 1212 rows.
Not knowing what is causing this,
I split my where condition restricting 400 records
each >>> time so making three queries rather than one,
then >>> finally I ended up creating 3 tables by running 3
select >>> into queries. I later did a bcp out of the
other two >>> tables into one table.
Post by unknown
Post by Mark A. Parsons
Post by unknown
My question is, why did not just "select only" took
care >>> of it?
Post by unknown
Post by Mark A. Parsons
Post by unknown
I am sure it has nothing to do with partition as there
is only one partition i.e. the default one.
Any ideas?
Thanks and Best Regards
Neal Stack [Sybase]
2009-12-02 16:21:30 UTC
Permalink
Hello,

Are you using the Interactive SQL (aka DBISQL)?

If you are using this tool rather than the plain old "isql" utility, go under
Tools/Options and select the "Adaptive Server Enterprise" option. Under the
"Results" tab, you can change the "Maximum number of rows to display". This
setting issues a "set rowcount xxx" under the covers which affects the
"select into" command as well as regular "select" queries.

Regards,
Neal
Mark A. Parsons
2009-12-02 17:36:20 UTC
Permalink
Hmmmm, I ran a test with the dbisql (version 11.0.0, build 1649) that comes with ASE 15.0.3 (EBF 16738) and don't see
the behaviour you're describing when using the default settings (including 'Maximum number of rows to display' = 500).

While a SELECT does limit the number of rows pulled back to 500, a SELECT/INTO successfully transfers 3900+ records from
the source table to the new/target table.

NOTE: I ran the test with 2 logins ... sa and a-plain-vanilla-login-with-no-roles ... and got the same results both
time, ie, all 3900+ records were copied into the new table

Do your comments apply to a different (older?) version of dbisql? Or is there another dbisql configuration setting at
work that could explain the OP's issue?
Post by Neal Stack [Sybase]
Hello,
Are you using the Interactive SQL (aka DBISQL)?
If you are using this tool rather than the plain old "isql" utility, go under
Tools/Options and select the "Adaptive Server Enterprise" option. Under the
"Results" tab, you can change the "Maximum number of rows to display".
This
setting issues a "set rowcount xxx" under the covers which affects the
"select into" command as well as regular "select" queries.
Regards,
Neal
Neal Stack [Sybase]
2009-12-02 22:10:17 UTC
Permalink
Hello,

I think it may have been this bug that was fixed around 15.0.2 ESD#3 or ESD#4:
481520 - DBISQL uses default options when launched from Sybase Central

The description doesn't sound related but I believe it was the culprit.

Regards,
Neal
Mark A. Parsons
2009-12-02 22:12:50 UTC
Permalink
OK, thanks.

FWIW, I bypassed SC and launched dbisql.exe directly from the DBISQL/bin directory.
Post by Neal Stack [Sybase]
Hello,
481520 - DBISQL uses default options when launched from Sybase Central
The description doesn't sound related but I believe it was the culprit.
Regards,
Neal
Loading...