Peter He


SQLServerCentral Article

CTE Performance

SQL Server 2005 brings a new feature to T-SQL with Common Table Expressions, which make it possible for more complex subquery expressions than in previous versions. Recursion is a common use and Peter He takes a look at how well these new structures perform.

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(18)

You rated this post out of 5. Change rating

2008-03-14 (first published: )

18,252 reads

SQLServerCentral Article

SET ROWCOUNT and TVFs

SQL Server 2000 has table valued functions that are very useful in many ways. However when you try to limit results with the ROWCOUNT setting, you can end up with some strange results. Peter He brings us a comprehensive look at some of the unpredictable results that you can get and how to code around them.

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2005-12-21

10,220 reads

Technical Article

Generate script for extended properties

The stored procedure generates insert script for table and column extended properties in the current database. The generated script checks whether a property exists, if it exists, drop it first. The stored procedure assumes table owner is dbo. It can be easily changed to other users.

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(1)

You rated this post out of 5. Change rating

2005-11-11 (first published: )

1,992 reads

Blogs

T-SQL Tuesday #203: Risk and Reward

By

This is timely, as I’m currently on a boat in the Adriatic taking a...

dataMinds Connect 2026 – Slides & Scripts

By

You can find the slides and SQL scripts for my session “Spice up your...

How to Clear the SSMS Cache (SSMS 21 and Later)

By

How to Clear the SSMS Cache (SSMS 21 and Later) Updated...

Read the latest Blogs

Forums

Using CHOOSE()

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Using CHOOSE()

Re-Seeding a Broken Log Shipping Secondary (Without Touching the Primary)

By LukaMK

Comments posted to this topic are about the item Re-Seeding a Broken Log Shipping...

The DBA is Dead! Long Live the !

By Grant Fritchey

Comments posted to this topic are about the item The DBA is Dead! Long...

Visit the forum

Question of the Day

Using CHOOSE()

We have this code that sets some status values and then queries them using the CHOOSE() function in SQL Server 2025.

CREATE TABLE Status
(
    StatusID INT,
    StatusDescription VARCHAR(20)
);
GO
INSERT dbo.Status
(
    StatusID,
    StatusDescription
)
VALUES
(0, 'Uncategorized'),
(1, 'Active'),
(2, 'Inactive'),
(3, 'Temp');

GO
SELECT CHOOSE(StatusID, 'Unknown', 'Active', 'Inactive', 'Temporary')
FROM Status;
When the SELECT runs, what is returned?

See possible answers