How can I stop SQL Server Management Studio replacing 'SELECT *' with the column list ?

Posted by Ben McIntyre on Stack Overflow See other posts from Stack Overflow or by Ben McIntyre
Published on 2010-03-04T05:13:41Z Indexed on 2010/03/08 6:06 UTC
Read the original article Hit count: 361

SQL Server Mgmt Studio is driving me crazy.

If I create a view and SELECT '*' from a table, it's all OK and I can save the view. Looking at the SQL for the view (eg.by scripting a CREATE) reveals that the 'SELECT *' really is saved to the view's SQL.

But as soon as I reopen the view using the GUI (right click > modify), SELECT * is replaced with a column list of all the columns in the table.

How can I stop Management Studio from doing this ? I want my 'SELECT *' to remain just that.

Perhaps it's just the difficulty of googling 'SELECT *' that prevented me from finding anything remotely relevant to this (i did put it in double quotes).

Please, I am highly experienced in Transact-SQL, so please DON'T give me a lecture on why I shouldn't be using SELECT *. I know all the pros and cons and I do use it at times. It's a language feature, and like all language features can be used for good or evil (I emphatically do NOT agree that it is never appropriate to use it).

Edit: I'm giving Marc the answer, since it seems it is not possible to turn this behaviour off. Problem is considered closed. I note that Enterprise Manager did no similar thing. The workaround is to either edit SQL as text, or go to a product other than Managment Studio. Or constantly edit out the column list and replace the * every time you edit a view. Sigh.

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about sql-server-management-stu