Select from dual in T-SQL / SQL Server

access_time 2 years ago visibility40 comment 0

In Oracle database, you can select from dual table if you only want to return a one row result set. In many other databases, the query engine supports select directly from constant values without specifying a table name. 

In SQL Server, you can directly select values without specifying a table name. 

Code snippet

SELECT "Constant Value" AS COLUMN_NAME;
info Last modified by Raymond 2 years ago copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Follow Kontext

Get our latest updates on LinkedIn or Twitter.

Want to publish your article on Kontext?

Learn more

More from Kontext

visibility 3920
thumb_up 0
access_time 6 years ago

In this serial, I will compare Teradata SQL with T-SQL with samples provided. This is mainly prepared for SQL Server DBAs, Developers and other users to help them quickly master the common used SQLs in Teradata platform. Similar to T-SQL, Teradata SQL implements most part of the ANSI SQL with ...

visibility 41
thumb_up 2
access_time 2 years ago

In different databases, the syntax of selecting top N records are slightly different. They may also differ from ISO standards.

visibility 120
thumb_up 0
access_time 5 months ago

SQL Server has built-in function HASHBYTES that can be used to calculate hash values. The supported hash algorithms include MD2, MD4, MD5, SHA, SHA1, SHA2_256 and SHA2_512. The signature of this function is: HASHBYTES ( '<algorithm>', { @input | 'input' } ) ...