[dba-SQLServer] interesting trick

Paul Nielsen pauln at sqlserverbible.com
Sun Feb 10 17:05:52 CST 2008


The number to refer to column ordinal position is only in the order by
clause. 
In a column list, you can include any expression or literal, it doesn't have
to be a column from the table. 

The simplest select statement is SELECT 1
Everything else is optional

-Paul



-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Susan
Harkins
Sent: Sunday, February 10, 2008 3:14 PM
To: Discussion concerning MS SQL Server
Subject: Re: [dba-SQLServer] interesting trick

Using SELECT 1 instead of SELECT * -- I know you can use a number to refer 
to a column's position, but its uses are limited. I found this reason 
interesting and probably wouldn't have thought of it on my own.

Susan H.


> Which trick are you referring to? Using an literal in the exist(select)?

_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com


__________ NOD32 2862 (20080210) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com





More information about the dba-SQLServer mailing list