Rowcount

  • bitbucket-25253 (2/1/2010)


    What we do not know is how many answer incorrectly, and do NOT post a moan and groan, but DO LEARN something which in the future will be of benefit to them.

    Let me guess: majority?

    For me, discussion is many times very interesting and very fruitfull. This one made me to think about things a little more.

    Thank god for such controverse QotDs, I learned a lot of them.



    See, understand, learn, try, use efficient
    © Dr.Plch

  • paul.goldstraw (2/1/2010)


    ....

    Nothing wrong with any of that, but for those who don't know the answer, should they be running the code before they answer, or after they have answered and got it wrong? I believe learning from mistakes is far better than not allowing yourself to make the mistake. It's not even so much people that do that as people that do it then bleat about it when the question is wrong that get me, and there were more than a handful going back through this thread admitting as much

    'I ran the code and it said 1,1 so i chose that and it gave me the wrong answer and i'm not happy!'

    Just doesn't seem right to me...

    I knew the answer was (0, 1) because I still use QA for 2005 and for 2008. I still tested it because I like my points. Then I learned that the answer that I knew had some qualifications. Nothing wrong with that. This isn't a contest.

    Tom Garth
    Vertical Solutions[/url]

    "There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers
  • First Time it gives 0,1

    Then second time when we run query again it gives output 1,1

    An d it must be 0,1

  • bitbucket-25253 (2/1/2010)


    I think that the QOD has two equally valid values.

    1. To allow individuals to test their knowledge.

    2. To teach.

    For those who know the answer it is a re-assuring experience

    For those who do not know the answer, running the code teaches them something (at least I hope it does)

    Hear, Hear 🙂

    I thought it was a sort of 'trick' question and so answered 0,1 :crying:

    Then I ran it to check and used QA on SQL2K it returned 0,1 :laugh:

    Then I noticed the 2005/2008 reference, damn :angry:

    Ran QA on 2005 and it returned 0,1

    Mmmm, thinks.... :rolleyes:

    Ran SSMS on 2005, returned 1,1 :w00t:

    Ran SSMS on 2000, returned 0,1 :crazy:

    So the moral is...

    If 2005/2008 is mentioned use SSMS 😀

    But I'm not complaining, learned something, and so, is worth more than 1 point 😛

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Not sure what I'm learning from this.

    Got 0, 1 when I first executed the 2 select lines in SSMS 2008 connecting to SQL Server 2005 - typed into a query window which had already executed some code.

    Got 1,1 in the same setup and instance when I executed the 2 lines into a freshly opened query window.

    Got 1, 1 when I first ran the 2 lines in a SSMS 2005 to SQL Server 2005.

    Some people care about the percentage of right answers to QOD ...

  • I've got (3, 1) becuase my latest query returned 3 rows.

  • I can see by the discussion thread that the answer was initially 0,1 - which was my answer. I got it wrong. The answer is now 1,1. I tested this on SQL 2000 and SQL 2005 using the same methodology. That is - I started query manger / management studio and did nothing else but run the query. SQL 2000 returned 0,1 SQL 2005 returned 1,1.

    This was a good question but unfortunately it would have been excellent if the version of SQL were specified.

    :hehe:

  • Hi,

    I ran this code in already opened SSMS windows and got 0,1 which is a wrong answer but later on I got 1,1...

    Can't seem to understand why I got 0,1 in the first run? I'm sure the connection to the db was active not disconnected.

    Razi, M.
    http://questivity.com/it-training.html

  • I got the different result sets in SQL 2005 and 2008. In 2005, I always getting output (1,1) whether it is a new (first) connection or new query window is open, but in case of SQL 2008, If it is new (first) connection then the output will be (1,1) but if it is new query window through the existing connection then it is (0,1)


    Warm Regards,

    Jignesh Mehta

  • The result of the first Select @@RowCount depends upon the last query executed in the session.

    I tried it in different ways;

    1. Executed query that returned n number of rows and then executed the two statements and the result was (n,1)

    2. I executed print '1' statement and then executed the two statements and the the result was (0,1).

    but the BOTTOM LINE is ....

    Lost my point....

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • Well, that taught me something new!

  • the result depends on previous statement.

  • I also executed the query in sql server 2005 query analyzer but i got (0,1) as the output.

Viewing 13 posts - 121 through 132 (of 132 total)

You must be logged in to reply to this topic. Login to reply