Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2008
    Location
    India
    Posts
    96

    Unanswered: 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

  2. #2
    Join Date
    Jan 2004
    Posts
    545
    Provided Answers: 4
    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!

  3. #3
    Join Date
    Jun 2008
    Location
    India
    Posts
    96
    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.

  4. #4
    Join Date
    Jan 2004
    Posts
    545
    Provided Answers: 4
    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!

  5. #5
    Join Date
    Sep 2003
    Location
    Switzerland
    Posts
    443
    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.

  6. #6
    Join Date
    Jun 2008
    Location
    India
    Posts
    96
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •