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 (https://blog.sqlauthority.com)
26 Comments. Leave new
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
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
Thanks Sumit,
I really appreciate you taking time to write this.
Kind Regards,
Pinal
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…
Never heard of this option. Not sure how you figured out that “PARSE ONLY” was the problem!
As suggested by Ramdas, I really wonder when this option would be useful.
Hi Pinal,
Can we add one new column in between the 2 other columns using sql query.
I did not find solution for this.
can you help me please.
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.
Giammarco Schisani,
It can be used if you just want to make sure that the query is correct without actually executing it
ramkoti,
It doesn’t matter the ordinal position of the column.You can use it in the preferred position in SELECT statement
Madhivanan
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
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
how to see every employee with his manager
You need to join with the same table to get this information
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.
This is very funny and useful….
Everyone learn from the mistakes this statement is correct. :)
Very nice article….
Thanks you
I am experiencing the same problem but PARSEONLY setting does not help (:
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(:
Please disregard I think that it was my mistake
how to find username & password in data base from sql managment studio 2008
Hi Pinal,
I too am facing the same issue, but the SET PARSEONLY is unchecked by default. Anything else to overcome this?
Thanks,
Shivram
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
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.
Dear sir
i facing the same problem but still the query result is not coming
plz help..
Regards: arjun