Monday, February 20, 2012

Management Studio: "select *",column names automatically filled in?

I am new to SQL 2005 and can't figgure this out. If I open a table, the
results are displayed. If I then modify the query statement (leaving
select *) and then click on execute, all of the column names are filled
in. Quite annoing. Is there any way to turn this "feature" off and just
leave the "*"?
It would also be nice to have the color coded query designer with an
editable result set, is there any way to do this?
Thanks!Most people don't want the particular feature you request as such
unqualified column fetches do not offer the best performance.
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"emde" <emdeusenet@.yahoo.com> wrote in message
news:1160774919.157908.248050@.h48g2000cwc.googlegroups.com...
>I am new to SQL 2005 and can't figgure this out. If I open a table, the
> results are displayed. If I then modify the query statement (leaving
> select *) and then click on execute, all of the column names are filled
> in. Quite annoing. Is there any way to turn this "feature" off and just
> leave the "*"?
> It would also be nice to have the color coded query designer with an
> editable result set, is there any way to do this?
> Thanks!
>|||Since you are new to SQL, please accept our encouragement to NOT use 'SELECT
*'.
It becomes a crutch because it seems so 'easy', yet over time, it can cause
problems. Too much unnecessary data retrieved (and transmitted), potential
for broken applications when there is a business need to add additional
columns to the table and the application doesn't expect them, etc.
It is a 'Best Practice' to only SELECT the specific columns needed for a
particular purpose.
Welcome to SQL Server, and good luck.
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"emde" <emdeusenet@.yahoo.com> wrote in message
news:1160774919.157908.248050@.h48g2000cwc.googlegroups.com...
>I am new to SQL 2005 and can't figgure this out. If I open a table, the
> results are displayed. If I then modify the query statement (leaving
> select *) and then click on execute, all of the column names are filled
> in. Quite annoing. Is there any way to turn this "feature" off and just
> leave the "*"?
> It would also be nice to have the color coded query designer with an
> editable result set, is there any way to do this?
> Thanks!
>|||emde wrote:
> I am new to SQL 2005 and can't figgure this out. If I open a table, the
> results are displayed. If I then modify the query statement (leaving
> select *) and then click on execute, all of the column names are filled
> in. Quite annoing. Is there any way to turn this "feature" off and just
> leave the "*"?
> It would also be nice to have the color coded query designer with an
> editable result set, is there any way to do this?
> Thanks!
For reasons of performance and maintainability you should always avoid
using SELECT * in any production-quality code. If you need to do this
for ad-hoc / non-production use you can just save the script as a
query. Click New Query and then save the file.
The fastest way to learn is to ignore the "designer" and "open table"
features and just type your queries directly. The query designer has an
annoying habit of rewriting your queries for you. It also has a lot of
limitations.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Thanks everyone. I am actually a long time SQL 2000 dba who is finally
making the switch to 2005. I only use select * when trying to debug
apps and make changes to data, etc. Thanks for the insight. I am sure I
will have many questions down the road and it looks like this is a
great group to hang out in.
Take care.

No comments:

Post a Comment