Advanced Querying

SQLServerCentral Article

Beauty is in the Eye of the Beholder

  • Article

Is dynamic SQL good or bad? We've had lots of arguments over the years in the forums and articles on both sides of the coin, though with most of the opinions being that dynamic SQL is bad. Stephen Hirsch brings us his own view that beauty is in the eye of the beholder.

You rated this post out of 5. Change rating

2006-09-19

5,800 reads

SQLServerCentral Article

The Joy of Numbers

  • Article

Numbers are fascinating concepts in all types of mathematics, but they can be very helpful as well in your SQL Server queries. Guru Michael Coles brings us a look at how a numbers table can you and includes a bunch of code for both SQL Server 2000 and SQL Server 2005.

5 (1)

You rated this post out of 5. Change rating

2006-08-14

18,172 reads

Technical Article

Using correlated sub-queries in SQL Server

  • Article

A sub-query is a SQL Server statement embedded inside of another SQL Server statement. The database engine treats a sub-query as a virtual table for the execution of the query. A sub-query can be used as a table in a join statement, as a single value in a select statement, in the where clause of a SQL Server query, in the having clause of a SQL Server query, or incorporated in data manipulation statements.

2006-08-07

4,276 reads

Blogs

Sic Transit Gloria Community

By

When Covid took out the PASS organization, I had someone say to me, “Well,...

DATEADD Truncates the Number Parameter: #SQLNewBlogger

By

This was an interesting thing I saw in a Question of the Day submission....

Our SQL Server is Slow! What Do I Do First?

By

Don’t Panic! It’s a vague but common complaint, frequently with no additional details. Before...

Read the latest Blogs

Forums

Dynamic T-SQL Script Parameterization Using Python

By omu

Comments posted to this topic are about the item Dynamic T-SQL Script Parameterization Using...

Error when trying to enable cdc . Could not update the metadata

By pamkagel

Server and db in SQL SERVER 2019. I have multiple tables that are enabled...

Parameter dataset doesn't show results in dropdown

By NineIron

My report has been working fine. Now, when I run the report, the Location...

Visit the forum

Question of the Day

A Strange Choice

What is returned when I run this code in SQL Server 2022?

CREATE TABLE CatIndex
( indexval VARCHAR(20)
)
GO
INSERT dbo.CatIndex (indexval) VALUES ('1'), ('2'), ('3')
GO
SELECT CHOOSE(indexval, cast('2025-01-01' AS DATE), CAST('2025-02-01' AS DATE), CAST('2025-03-01' AS DATE))
FROM dbo.CatIndex AS ci

See possible answers