IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact

String Literals as Column Aliases are Deprecated

Something that’s still found in SQL scripts in enterprise environment, even with newly written scripts is the use of string literals as column aliases.

SELECT record_id AS ID, account_number AS 'Account Number'
FROM RequestTable

Although this feature has been deprecated since 2012, old habits die hard.

SQL Server deprecated features using string literals as column aliases

So what’s the right way to write it?

You can either use alias without a whitespace or use a double quote character. Either of these examples below is acceptable.

SELECT record_id AS ID, account_number AS Account_Number
FROM RequestTable

OR

SELECT record_id AS ID, account_number AS "Account Number"
FROM RequestTable

You can read more about this deprecated feature from the links below.

Further Reading

SQL Server, Deprecated Features Object
DEP021: String literals as column aliases are deprecated
SQL Prompt code analysis: avoid non-standard column aliases (ST002 and DEP021)
Format SQL Using Redgate SQL Prompt

December 9, 2022 Filed Under: Database Tagged With: Microsoft SQL Server, SQL, SQL Server

Buy me a coffee?

Buy me a coffee If you find any of the articles or demos helpful, please consider supporting my work here, you'll have my big thanks!

Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2025 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure