Forum Discussion
SQL-Server Management Studio: deactivate wildcard expansion
Hello everybody,
I need to save a view with a table with wildcard, like "SELECT * FROM country".
However, the MS SQL-Management Studio automatically expands the the wildcard with the fields of the table "country", to "SELECT country.id, country.description, country.president FROM country".
Since the respective table is supposed to be user-defined, the view that I deploy must contain a wildcard rather than named fields.
So: how do I deactivate the automatic expanson of this wildcard?
EDIT: I have found a work around: as long as I just use the diagram pane and not the SQL-Pane of the editor, "Save" saves the asterix without expansion of the fields and everything works just fine. Strange, anywy.
Hoping for help
Joachim
- olafhelperBronze Contributor
how do I deactivate the automatic expanson of this wildcard?Joachim20095 , you can't and this simply because that's not the way a database engine like SQL Server works.
You create a view, db engine compiles the SQL for it to get a fix definition for it; end of the story.
Changes on the base table don't change anything on the view definition, even if you recompile the view.
The wanted behaviour don't make sense; how should client applications handle the unknown view definition?
And table changes doesn't come form heaven, the are man-made and that man can change the view as well, if required.
- Joachim20095Copper Contributor
olafhelperthank you very much, but that's not correct. It has worked for years in the past when I used another SQL-Editor (which is no longer available). And it works, for instance, when I use "SELECT * FROM country" in the code.
It's one of the popular features of my software that users may add their own datafields and work with them, for instance when creating Word-Documents (see https://a-jur.de/spezielle.htm).I am convinced that it's just a little checkbox in the depths of the SQL-Management Studio that controls this behaviour - I just cant' spot it.
Best regards from Germany!
Joachim20095