Single Digit Special Characters used between SELECT and FROM in SQL

Written by

Introduction

Yup, many of us would guess and say ‘*’ (Asterisk) . Yes, of course it’s right and it will be our first answer. But What if my question is what other special characters except ‘*’ ?

Single Digit Special Characters used between SELECT and FROM except *

Many of us uses ‘*’ (Asterisk) as Single Digit Special Characters in our day-to-day life for the purpose of fetching all columns from our tables and written queries in SQL Server.

SQL Script – Sample Table Creation with Data

--Sample TABLE Creation with Data
IF OBJECT_ID('..TestEmp') IS NOT NULL
	DROP TABLE [TestEmp];
CREATE TABLE dbo.[TestEmp] 
(
	TestEmp_Key INT IDENTITY(1,1) NOT NULL,
	EmpName VARCHAR(100) NOT NULL
);
GO

INSERT INTO dbo.[TestEmp]
(EmpName)
VALUES
('Arulmouzhi'),('AlveenaJoyce'),('Madhivanan');
GO

Using Asterisk *

SQL Script

SELECT * FROM dbo.[TestEmp];   
GO
Using Asterisk *

Using Other Single Special Characters except *

SQL Script

SELECT 
£ [£],$ [$],€ [€],¢ [¢],
¥ [¥],₱ [₱],\ [\] FROM dbo.[TestEmp];   
GO

Using Other Single Special Characters except *

List

Some of the Special Characters used in SQL Server

NOTE

Like mentioned in the above query, we can use some of the currency symbols just like * between SELECT and FROM in SQL Server. Above mentioned are some of the Currency Symbols that SQL Supports.

SQL Script – Example

SELECT 
£1 [£],$2 [$],€3 [€],¢4 [¢],
¥5 [¥],₱6 [₱],\7 [\];   
GO

Currency Values

To Find Datatype

To find the above mentioned symbol’s datatypes, we can use View Table Structure method like below.

SQL Script

IF OBJECT_ID('TEMPDB..#A') IS NOT NULL
	DROP TABLE #A;
SELECT 
£1 [£],$2 [$],€3 [€],¢4 [¢],
¥5 [¥],₱6 [₱],\7 [\] INTO #A;  
--SELECT * FROM #A;
EXEC TEMPDB..SP_HELP '#A';

Money Datatype

Conclusion

Thus, we saw what are the other single digit special characters except * and their datatypes that we can use between SELECT and FROM in SQL Server. The above Scripts ran and Unit tested in both On-premises and Azure SQL DB.

FOLLOW for Interesting Upcoming Posts!

Article Categories:
SQL Server

Leave a Reply

Your email address will not be published. Required fields are marked *

Shares