Microsoft® SQL Server® 2012 Bible

(Ben Green) #1

211


Chapter 8: Data Types, Expressions, and Scalar Functions


8


■ (^) InstanceName: Null if the default instance
■ ProductVersion: The version number of SQL Server
■ (^) ProductLevel: “RTM” for the initial release-to-manufacturing version, “SPn” for
service packs (n is the service pack number), and “CTP” for Community Technology
Preview versions
■ ServerName: The full server and instance name
For example, the following code returns SQL Server engine edition and version information
for my current instance of SQL Server:
SELECT
SERVERPROPERTY ('ServerName') AS ServerName,
SERVERPROPERTY ('Edition') AS Edition,
SERVERPROPERTY ('ProductVersion') AS 'ProductVersion',
SERVERPROPERTY ('ProductLevel') AS ProductLevel;
Result:
ServerName Edition ProductVersion ProductLevel




WIN-V7B3M53ERC1\DENALICTP3 Developer Edition (64-bit) 11.0.1422.17RTM


Summary


Chapter 7, “Relational Database Design and Creating the Physical Database Schema,” intro-
duced the basic SELECT statement and query fl ow. This chapter expanded the concept
with expressions and calculations that can be inserted in several places within the query,
signifi cantly improving its fl exibility. In subsequent chapters, you see how expressions can
receive data from subqueries and user-defi ned functions, further increasing the power of
the query.

Chapter 9, “Merging Data with Joins, Subqueries, and CTEs,” continues the progression of
adding capability to the query by joining data from multiple data sources.

c08.indd 211c08.indd 211 7/30/2012 4:21:18 PM7/30/2012 4:21:18 PM


http://www.it-ebooks.info
Free download pdf