T-SQL

SQLServerCentral Article

Should I Type * or 1 With the EXISTS Logical Operator

  • Article

In my project I see that people writes different things with EXISTS logical operator (EXISTS (SELECT StarOrOne FROM...)). They are "*", "1" and even "TOP 1 1" or "TOP 1 *". The aim of this article to give a good explanation which option is the best.

4.59 (44)

You rated this post out of 5. Change rating

2020-01-24 (first published: )

14,859 reads

Blogs

The Book of Redgate: What Our Customers Say

By

This is from 2010, but I loved that people felt this way about Redgate...

Export a Power BI Report that cannot be Downloaded

By

Yes, you’re reading that right, we’re going to download a report that cannot be...

Query Intelligence in SQL Server 2025: What Developers Need to Know

By

When Microsoft announced SQL Server 2025, I was curious about what would truly change...

Read the latest Blogs

Forums

Poor Name Choice

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Poor Name Choice

Getting the Indexed Columns

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Getting the Indexed Columns

T-SQL in SQL Server 2025: Substring Changes

By Steve Jones - SSC Editor

Comments posted to this topic are about the item T-SQL in SQL Server 2025:...

Visit the forum

Question of the Day

Getting the Indexed Columns

I run this code on SQL Server 2022 to get a list of all the indexes and their key columns. What is returned?

SELECT   
    INDEX_COL (N'AdventureWorks2017.Sales.SalesOrderDetail')

See possible answers