SQL SERVER – SSMS Query Command(s) completed successfully without ANY Results

Yesterday night, I received a phone call from one of my friends with whom I used to work in USA. I was very pleased to receive this call from my old friend after 2 years, but the situation was not good on his side. He said that whatever query he runs, he just receives a message like Query Command(s) completed successfully without any result. However, when he opened a new window, it worked fine. He said he could not figure out the reason for the same and his manager who was standing nearby asked him to find out the reason and not to close the window till he figures this out. Hmm… I really find this whole story very funny. I just thought this was overkill for them to call me all the way to India for this question. Of course, I told him that I do not believe his story at all!

Well in short, I remote logged in to his system and found out that his particular session, which was not returning any result, had one of the query settings set wrong.

As soon as the settings were unchecked, everything seemed to work fine. We could have used T-SQL to turn this option off and also the SET PARSEONLY OFF option.

We both had a really good time after that talking about old times. Anyway I still believe that there was no emergency, and he just wanted to call me at an odd time!

Reference: Pinal Dave (http://blog.SQLAuthority.com)

About these ads

27 thoughts on “SQL SERVER – SSMS Query Command(s) completed successfully without ANY Results

  1. That sure was funny :)

    Here’s couple of shortcuts if someone doesn’t know this already.

    F5 = run query
    CTRL+F5 = parse only
    CTRL+L = execution plan

    In case your CTRL button isn’t functioning properly I suggest you use mouse when using parse only. I had to learn this the hard way ;)

    • Hi Marko,

      This are very helpful shortcuts.

      Yeah the story was funny but I was glad after the problem was solved (which took less than 2 mins at whole) we talked for half an hour! As I said, he just wanted to find excuse to call me 3 AM midnight India time.

      Thank you again!

      Kind Regards,
      Pinal

  2. You are the best.
    I mean this is just a simple thing and nobody in SQL Community have courage to take it to front and post because they thought it is a very small thing, but nobody thinks about the freshers like us who really want to learn through scratch.
    Many thanks to you for what ever you doing to Indian SQl Community.
    Thanks

  3. Hi Pinal,
    Thank you for bringing out the option PARSE ONLY, I can see how it can be frustrating to the developer if he was not aware of this option.
    I would like to ask one question though: When would be a situation where one would actually need this option to be turned on in the settings…

    • Well, yes and no.

      You can’t directly add column between two columns. You can alter table and create a new column but it goes last to the columns list. You could now go and mess up with the system tables to set your column order but it is not a good idea.

      Other way, which SSMS uses I think, is to create a new table (with some temporary name) with all the columns in the old table plus the new column in the correct place. Then insert all the rows in the old table into the new table, drop the old table and rename the new table.

  4. In SQL 2008 SSMS query window I save my results to file. In SQL 2000 QA I would get the message: The following file has been saved successfully:

    But, I dont get that message in SQL 08 even though the file did successfully save? Does anyone know why? thanks

    Dale

  5. Pingback: SQL SERVER – Mirroring Configured Without Domain – The server network address TCP://SQLServerName:5023 can not be reached or does not exist Journey to SQL Authority with Pinal Dave

  6. I do fear this is not working for me. I have done what you said about unchecking the set parseonly option, but alas, it was unchecked from the beginning. In my case I want to see the results of several select statements like that

    select @id_ass,@id_compte,@compte,’TEXT’,ROUND(@haver,2)-ROUND(@debe,2),0

    which are inside a FETCH NEXT FROM CURSOR loop. First time I run the query it worked just fine, but subsequents executions (in the same window or in others) only show the command(s) executed succesfully message that we all already know.

    Any suggestion of what am I missing? Thank you in advance, and also thank you for the help you provide for all of us, newbie programmers.

    • Even i am having the same problem the option is unchecked but still getting the same result command executed successfuly.Please help me sir

  7. I got this Query Command(s) completed successfully without any result in Store Proc. Tried to use SET PARSEONLY OFF in SP but got the error:

    Cannot set or reset the ‘parseonly’ option within a procedure or function.

    Is there anyway to fix that? Thank you.

  8. This is very funny and useful….
    Everyone learn from the mistakes this statement is correct. :)
    Very nice article….
    Thanks you

  9. Pingback: SQL SERVER – Weekly Series – Memory Lane – #012 « SQL Server Journey with SQL Authority

  10. Want to share some details. My WEB application shown result as expected I just had problem seeing result in SSMS. Also it seems that I did not have this problem with this SP before. I noticed that if I add Select ‘OK’ statement then SP will show result in SSMS but obviously WEB page stopped working. I started experimenting with code. I had IF statement and I decided to replace it with UNION. As soon as IF gone I could see result in SSMS. I don’t have any explanation(:

  11. Hi Pinal,

    I too am facing the same issue, but the SET PARSEONLY is unchecked by default. Anything else to overcome this?

    Thanks,
    Shivram

  12. Hi Pinal,

    I am also facing the same problem.But the SET PARSEONLY is unchecked by default.
    And also any query that i type gets completed successfully. If i create a new table, it gets
    completed successfully.But actually the table is not created. Nothing actually happens but
    gets completed successfully.

    Pls pls help..

    Thanks,
    BJ

  13. I face the same problem. But the SET PARSEONLY is unchecked by default. I get Command(s) completed successfully and nothing happens. Please help me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s