From: Ryan on 9 Apr 2010 18:03 I want to write a SELECT query for all fields except for one field that I want to exclude from the select statement. Let say I have a table containing 150 fields; I want to read 149 fields and exclude one field e.g Field_126 Is it possible to get this done without listing 149 fields explicitly?
From: Michael Coles on 9 Apr 2010 19:28 Not directly. Here are a couple of alternatives: - In SSMS you can right click a table and choose Script Table As > Select To > New Query Editor Window and let SSMS generate the query for you. Then just delete the column(s) you don't want. - You could create a view that explicitly names just the columns you want to return. Note that using SELECT * is not a best practice in production code. -- Thanks Michael Coles SQL Server MVP Author, "Expert SQL Server 2008 Encryption" (http://www.apress.com/book/view/1430224649) ---------------- "Ryan" <Ryan(a)discussions.microsoft.com> wrote in message news:A5E11479-183E-4A7D-93B0-2CCEB3668722(a)microsoft.com... > I want to write a SELECT query for all fields except for one field that I > want to exclude from the select statement. > Let say I have a table containing 150 fields; I want to read 149 fields > and > exclude one field e.g Field_126 > > Is it possible to get this done without listing 149 fields explicitly?
|
Pages: 1 Prev: Problems inserting into attached MDF from MFC Next: Get Month and Year from death field |