locked
select of a table RRS feed

  • Question

  • Hi all,

    I have imported serval tables from an IBM iSeries with the import data support from sql server 2008 R2.

    If I try to read a table with select * from ... in sql server 2008 R2 Management studio, nothing happens. The query runs and runs and runs......

    In opposite this, when I make a right mouse click on such an imported table and press "Select Top 1000 Rows", the sentence will shown directly.

    When I make a copy and past with the same "Select Top 1000 Rows" or type it manually, nothing happens.The query runs and runs and runs.

    I don't know, what is the reason for this behavior.

    Many thanks for answer! 


    • Edited by cologne1234 Wednesday, March 7, 2012 2:29 PM
    Wednesday, March 7, 2012 2:28 PM

Answers

  • Oh, Man! Hugo, you are the best and I have the famous plank in front of my head!

    Thank you very much!

    • Marked as answer by cologne1234 Wednesday, March 7, 2012 4:42 PM
    Wednesday, March 7, 2012 4:27 PM

All replies

  • Is it huge table? Do not use SSMS, just type in Query Builder SELECT TOP 100 * FROM tbl ORDER BY ...

    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/

    Wednesday, March 7, 2012 2:30 PM
    Answerer
  • OK! But what I don't understand: If I make the right mouse click, it runs quickly (and there is no order by clause). If I type it manually or make copy/past of this sql command, nothing happens.

    Same result with order by clause!

    The table has ca. 50000 sentences.

    • Edited by cologne1234 Wednesday, March 7, 2012 2:49 PM
    Wednesday, March 7, 2012 2:40 PM
  • This looks weird , Can you open a new session and then try running the query?

    also can you check whether when the query is running is there any blocking?


    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com


    Wednesday, March 7, 2012 2:48 PM
    Answerer
  • Same behavior when I open a new session.

    Wednesday, March 7, 2012 2:54 PM
  • Hi cologne1234,

    Just to clarify - when you manually execute the query, does it say
    "Executing query" in the lower left corner of the query window?

    If not, you haven't started execution. I don't know anything about IBM
    iSeries, but in SSMS, hitting Enter or typing go will not start
    execution of your query. You need to click the Execute button on the
    toolbar. (Or select Query / Execute from the toolbar, or hit F5).


    Hugo Kornelis, SQL Server MVP
    My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
    Wednesday, March 7, 2012 3:35 PM
  • Yes, Yes! I press the green arrow "Executing query".

    What I try futherwise: I create a database TTTT. Then I crate a table VVVV with two columns AAA and BBB.

    I insert two sentence.

    Then I open a new query windows and press:

    use TTTT

    select * from VVVV

    and press execute button.

    the query runs and runs and runs....

    I break down the query with the little rectange red button.

    Then I press right mouse click on table VVVV and press "Select Top 1000 Rows" and "zack": I see the two inserted sentences.

    Wednesday, March 7, 2012 3:57 PM
  • Hi cologne1234,

    Yes, Yes! I press the green arrow "Executing query".

    Welcome to the club! You're not the first to be bitetn by that
    confusion, and I'm afraid you won't be the last either.

    For executing a query, you want to click the (somewhat larger) buttomn
    that has a red exclamation mark and the text "Execute" on it. The
    green arrow is the button for "Debug". It will do some stuff to set
    the debugging going, then wait for you to select to single-step
    through your code, or set a breakpoint and run uninterrupteed until
    you get at the breakpoint.

    You'll probably never use the Debug functionality. It can prove handy
    sometimes, when you develop large and complex stored procedures, but
    for debugging queries it is useless (as it executes the entire query
    as a single step).

    Type the command, hit the "real" execute button (or hit F5 or Ctrl+E),
    and your query should finish quickly!


    Hugo Kornelis, SQL Server MVP
    My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
    Wednesday, March 7, 2012 4:15 PM
  • Oh, Man! Hugo, you are the best and I have the famous plank in front of my head!

    Thank you very much!

    • Marked as answer by cologne1234 Wednesday, March 7, 2012 4:42 PM
    Wednesday, March 7, 2012 4:27 PM