Re: Select query help+primary key
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Tue, 25 Jul 2006 10:43:05 +0000 (UTC)
Iain Adams (aca04iba@xxxxxxxxxx) writes:
Hey I want to get some data from some tables but I want every field
except the primary key field returned. Is this possible?
I.e SELECT * (except primary) FROM table1, table2, table3
SELECT col1, col2, col3, ... FROM ...
While SELECT * is handy when running ad hoc-queries, SELECT * should not
be used in production code.
I would also recommand that you only return the columns that the client
actually need. A problem that I often face in our system is to find out
whether where a column is used. Finding which stored procedures is simple,
but if I see a procedure that returns about all columns in the table, I
can't really tell whether the column is actually in use, or if someone added
it just in case.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- References:
- Select query help+primary key
- From: Iain Adams
- Select query help+primary key
- Prev by Date: Deleting more duplicates
- Next by Date: syntax error ALTER TABLE
- Previous by thread: Select query help+primary key
- Next by thread: Re: Select query help+primary key
- Index(es):
Relevant Pages
|