Technical Article

Query Hierarchical data Using CTE in T-SQL 2005

In response to Sam Stange's "An old and new way to query Hierarchical data", this script uses the new CTE feature of SQL Server 2005 to display the hierarchical data all at once. I have added a check to prevent infinite loop in case there is a loop in the data (actually, there is one […]

3.67 (3)

You rated this post out of 5. Change rating

2007-04-11 (first published: )

1,431 reads

Technical Article

Function Based Index in T-SQL

To build function based index in SQL Server, you can use indexed view (materialized view) or using a computed column. In this script, I give an exmaple of how to use the computed column to implement a function based index on a table to search through a free formated telephone number column. The basic step […]

5 (3)

You rated this post out of 5. Change rating

2007-04-10 (first published: )

8,799 reads

Blogs

Advice I Like: Apologies

By

How to apologize: quickly, specifically, sincerely. Don’t ruin an apology with an excuse –...

Build a Serverless Todo App With AWS, Pulumi, and Python

By

Try this step-by-step guide to build and deploy a scalable serverless app that’s accessible...

Master SQL Subqueries with This Free Course

By

Want to boost your SQL game? Check out this free course, SQL Subqueries: Real-World...

Read the latest Blogs

Forums

SQL Clustered Resource in online pending for about 3-5 mins before coming online

By PJ_SQL

Hello! SQL Clustered resource used to come online during manual or automatic failover in...

SQL Query to use in MS SSRS server to give you your report structure.

By wolfsvein

Code that can be used in order to create dashboard or SSRS report on...

Temp table security

By Brandie Tarvin

So, I have an interesting situation that I need a double-check on. One of...

Visit the forum

Question of the Day

Escaping Like I

I have this data in a SQL Server 2022 table:

PlayerIDPlayerNamePlayerStatus
1The \%ChampActive
2The ChampActive
3The_ChampionActive
4The__ChampionActive
5The\_ChampActive
How many rows are returned by this code in SQL Server 2022?
select PlayerName from player
where playername like 'The\_C%' escape '\'
 

See possible answers