Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Sybase > No of Columns in a select clause

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-25-08, 04:50
karthi_syb karthi_syb is offline
Registered User
 
Join Date: Jun 2008
Location: India
Posts: 58
No of Columns in a select clause

All,

I have exexuted a select statement which is having more than 2500 columns,But i got the error message.

The transaction was aborted because it used too much stack space. Either use sp_configure to increase the stack size, or break the query into smaller pieces. spid: 225, suid: 790, hostname: X3RWTYR, application name: SQL_Advantage
Reply With Quote
  #2 (permalink)  
Old 06-25-08, 05:02
Martijnvs Martijnvs is offline
Who? Me?
 
Join Date: Jan 2004
Location: The Hague/Utrecht, NL
Posts: 273
2500 columns is an awful lot...
How many tables are you joining? Or is it one single table?
__________________
I'm not crazy, I'm an aeroplane!
Reply With Quote
  #3 (permalink)  
Old 06-25-08, 05:14
karthi_syb karthi_syb is offline
Registered User
 
Join Date: Jun 2008
Location: India
Posts: 58
Actually, i am doing it for testing purpose to know the maximum no of columns in a single select statement.

So what i did was i have created a sequence of number in an excel sheet and used in my query.

say for example,

select 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,..... ......<some number>

when i took 2000, the query worked fine.

Simply , i did this R&D to know the usage of maximum no of columns in a single select clause.

I am using sybase 12.0 version.
Reply With Quote
  #4 (permalink)  
Old 06-25-08, 06:02
Martijnvs Martijnvs is offline
Who? Me?
 
Join Date: Jan 2004
Location: The Hague/Utrecht, NL
Posts: 273
There is a difference between the limits of ASE and the limits of your system. I do not know for sure if there is a maximum amount of columns you can specify in a query, although there is such a limit in how many columns a table can have.

Taken in account you're trying to select 2500 columns, I think it's a resource-issue. There just isn't enough memory allocated for ASE, or there isn't enough memory in your system. Anyhow, 2500 columns is very, very much for a single selectstatement, so I'd rather try to rewrite it in smaller queries than to boost or tune your system so it can handle this amount of columns.
__________________
I'm not crazy, I'm an aeroplane!
Reply With Quote
  #5 (permalink)  
Old 06-25-08, 13:50
trvishi trvishi is offline
Registered User
 
Join Date: Sep 2003
Location: Switzerland
Posts: 370
Quote:
Originally Posted by karthi_syb
All,

I have exexuted a select statement which is having more than 2500 columns,But i got the error message.

The transaction was aborted because it used too much stack space. Either use sp_configure to increase the stack size, or break the query into smaller pieces. spid: 225, suid: 790, hostname: X3RWTYR, application name: SQL_Advantage

1. The max no of columns you can have is 1024 per table.
2. Sum of column size cannot exceed page size

Look for 'create table' in the Reference Manual in http://sybooks.sybase.com

Having said the above, Im just curious why you are after this.

a) You are just curious and just want to know.
b) You really have a requirement.

If its a), you really need to use your time learning Sybase better.
If its b), you really should be joking.
Reply With Quote
  #6 (permalink)  
Old 06-26-08, 06:08
karthi_syb karthi_syb is offline
Registered User
 
Join Date: Jun 2008
Location: India
Posts: 58
trvishi,

I just wanted to know, so i go for option 1. But As you said, i already saw that a table can have maximum 1024 columns.

But My question is how many columns can appear in a single select statement ?

Thanks for your answer.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On