Results 1 to 6 of 6
  1. #1
    Join Date
    May 2003
    Location
    Bangalore(India)
    Posts
    4

    Unanswered: set row count problem

    Hello ,
    I m using Sybase Adaptive IQ 12.4.3 server.I am trying to limit the size of rows fetched from a table which contains 12 lac records.After selecting the records I am writing them to a flat file using Export .
    But my set rowcount statement is not showing any effect and whole of my 12 lac records are written into the file.The code i m using is as below:
    boolean b=stmt.execute("select customer_key,month_key,service_key,status_key,comb
    ined_revenue into #temporary from telco_facts ");
    stmt.execute("set rowcount 100");
    stmt.execute("SET TEMPORARY OPTION Temp_Extract_Name1='f:\\topRec.txt'");
    stmt.execute("select * from telco_facts order by service_key");

    If instead of exporting the data into flat file ,I select it into a resultset
    set row count works.I m using JConnect 5.5 JDBC driver.
    Please suggest me how should I resolve this problem.
    Is there any other way of restricting the no of rows selected.
    Thanks in advance.
    Bharat

  2. #2
    Join Date
    Dec 2002
    Location
    india
    Posts
    3
    Hi Bharat

    You change the order by of your statements as per following method and try out.


    stmt.execute("set rowcount 100");
    boolean b=stmt.execute("select
    customer_key,month_key,service_key,status_key,comb
    ined_revenue into #temporary from telco_facts ");
    stmt.execute("SET TEMPORARY OPTION
    Temp_Extract_Name1='f:\\topRec.txt'");
    stmt.execute("select * from telco_facts order by
    service_key");

    Sivakumar

  3. #3
    Join Date
    May 2003
    Location
    Bangalore(India)
    Posts
    4
    Hi siva,
    Thanks for the reply.
    I implemented your suggestion but that is also not working.
    My aim is to first sort some 10 lac records and then select the top N no of records.So setrow count should come ideally after I have selected my records in the temp table and sorted them.
    If you have any other ideas then pls advise.
    Thanks
    Bharat

  4. #4
    Join Date
    Mar 2001
    Location
    Lexington, KY
    Posts
    606
    Create your temp table with an identity column, then select where the identity column <= 100.
    Thanks,

    Matt

  5. #5
    Join Date
    May 2003
    Location
    Bangalore(India)
    Posts
    4
    Thanks Matt
    I was able to achieve the desired result by using stmt.execute("set temporary option row_count =100"); instead of the stmt.execute("set rowcount 100");My problem is resolved.But still I m not able to understand why stmt.execute("set rowcount 100"); did not work.Do you have any idea??
    Regards,
    bharat

  6. #6
    Join Date
    Mar 2001
    Location
    Lexington, KY
    Posts
    606
    IQ is different than ASE. ASE uses SET ROWCOUNT, I do not know what IQ uses.
    Thanks,

    Matt

Posting Permissions

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