Tutorialsteacher

Follow Us

Articles
  • C#
  • C# OOP
  • ASP.NET Core
  • ASP.NET MVC
  • LINQ
  • Inversion of Control (IoC)
  • Web API
  • JavaScript
  • TypeScript
  • jQuery
  • Angular 11
  • Node.js
  • D3.js
  • Sass
  • Python
  • Go lang
  • HTTPS (SSL)
  • Regex
  • SQL
  • SQL Server
  • PostgreSQL
  • MongoDB
  • SQL Server - Get Started
  • Install SQL Server
  • SQL Server Management Studio
  • SQL Server - Windows Authentication
  • SQL Server - Authentication
  • SQL Server - Create New User
  • SQL Server - GRANT/REVOKE Permissions to User
  • SQL Server - Data Types
  • SQL Server - Naming Conventions
  • SQL Server - CREATE Database
  • SQL Server - CREATE Table
  • Add Columns
  • Identity Column
  • Rename Column, Table
  • Drop Columns
  • SQL Server - Schema
  • SQL Server - Tables Relations
  • SQL Server - Primary Keys
  • Modify/Delete Primary Keys
  • SQL Server - Foreign Keys
  • Modify/Delete Foreign Keys
  • SQL Server - Check Constraints
  • SQL Server - Unique Constraints
  • SQL Server - Views
  • Modify/Delete Views
  • SQL Server - Functions
  • SQL Server - Stored Procedures
  • Stored Procedure Parameters
  • SQL Server - Indexes
  • Non-clustered Indexes
  • Modify/Delete Indexes
  • SQL Server - Triggers
  • DDL Triggers
  • LOGON Triggers
  • Enable/Disable Triggers
  • Modify/Delete Triggers
  • SQL Server - Sequence
  • SQL Server - Synonyms
  • SQL Server - IF ELSE Statement
  • SQL Server - Loops
  • SQL Server - Insert Data
  • SQL Server - Update Data
  • SQL Server - Delete Data
  • SQL Server - Select Query
  • WHERE Clause
  • GROUP BY Clause
  • HAVING Clause
  • ORDER BY Clause
  • SQL Server - Inner Join
  • Left Join
  • Right Join
  • Full Join
  • Self Join
  • Dynamic SQL
  • Built-in Functions
Entity Framework Extensions - Boost EF Core 9
  Bulk Insert
  Bulk Delete
  Bulk Update
  Bulk Merge

SQL Server 2019 Naming Conventions

SQL Server defines a set of rules (dos and don'ts) for naming SQL Server Objects called naming convention, but also gives the user to follow their own preferred style. It is advisable to follow a single naming convention for all database objects consistently.

Why Use Naming Conventions

Following a naming convention for tables, columns, and all other related database objects like views, stored procedures, indexes, triggers, etc., are important for the success and maintenance of a project. A database can have many tables and users working on it. By following a naming convention, you can spend less time finding what you need and helps in efficient database management.

SQL Server Database Object Naming Rules

  • Names of database objects such as tables, columns, stored procedures, views, etc, can contain alphanumeric characters and must begin with an alphabet or an underscore.
  • Case sensitivity is determined by the settings of the database in which the object is created. By default, SQL Server is not case sensitive.
  • Avoid quotes while naming a database object.
  • Use full English words and avoid abbreviations.
  • Object names can contain numbers, #, $, @, but avoid using them.
  • Certain symbols at the beginning of an object name have special significance in SQL Server.
  • A name that starts with the 'at' (@) sign always denotes a local variable or parameter and cannot be used as a name for any other type of object.
  • A name that begins with the number sign (#) denotes a temporary table or procedure.
  • A name with double number signs (##) denotes a global temporary object. Microsoft doesn't recommend using the single number sign or double number sign to begin an object name.
  • Some Transact SQL function names start with double at (@) signs. To avoid confusion, Microsoft recommends not using names that start with @.
  • The Object name should not be a Transact SQL reserved word. SQL Server reserves both lowercase and uppercase versions of reserved words.
  • Embedded spaces or special characters are not allowed.
  • Supplementary characters are not allowed.
  • Some system procedures and functions are given prefixes like 'sp_', 'xp_', or 'dt_' to signify that they are system objects and should be searched for in the master database. So it is better to avoid using these prefixes while creating database objects.
  • There are a few commonly accepted styles to name a table & column in a database. It can be all 'lower case, 'UPPERCASE', 'Pascal Case' or 'camel Case'.
  • Avoid using spaces between words for table names and columns as they will require square brackets and confuse scripts and procedures. Instead, use an underscore for joining multiple words. For example, EMPLOYEE_SKILL, employee_id instead of [EMPLOYEE ID].
  • If a table represents a real-world entity, then use nouns to name the table. Example: EMPLOYEE, CITY, COUNTRY.
  • Table names should be less than 126 characters.
  • For table names, you can use either singular or plural. Example: EMPLOYEE OR EMPLOYEES.
  • Avoid using prefixes like 'tbl_' for table names.
  • While naming columns, use nouns that describe what is stored in the column. Example: FIRST_NAME, ADDRESS, EMAIL, PHONE. Avoid using words that are just data types like text or date.
TUTORIALSTEACHER.COM

TutorialsTeacher.com is your authoritative source for comprehensive technologies tutorials, tailored to guide you through mastering various web and other technologies through a step-by-step approach.

Our content helps you to learn technologies easily and quickly for learners of all levels. By accessing this platform, you acknowledge that you have reviewed and consented to abide by our Terms of Use and Privacy Policy, designed to safeguard your experience and privacy rights.

[email protected]

ABOUT USTERMS OF USEPRIVACY POLICY
copywrite-symbol

2024 TutorialsTeacher.com. (v 1.2) All Rights Reserved.