Category: SQL Server

What is the Difference between varchar and nvarchar in SQL Server?

The SQL Server has the data type varchar and nvarchar . What is the main difference between the both ? Let’s explore it in this article. What is the Difference between varchar and nvarchar in SQL Server? varchar is a variable length and non-unicode data type which can take the 8-bit codepage. The collation of the database identifies which of the code page should be…

How to Update From Select Statement in SQL Server ?

Below is a sample query that demonstrates how to update a table by getting the data from the select query in SQL Server. Assume that there are 2 tables AbundantCodeEmployee and AbundantCodeDepartment which contains the id . The id(in department) in this example refers to the department head . The columns “DepartmentName” is updated in the query based on the value retreived  . How to Update From…

How to Add a Column with Default Value to Existing Table in SQL Server ?

Looking to add a column with default value to an existing table in SQL Server ? Below is an example and sample Data Definition Language Query for achieving the same. How to Add a Column with Default Value to Existing Table in SQL Server ? Assume that the table name is “ACEmployee” which already exists and you want to add a new column called “Status”…

How to Check if the table exists in SQL Server ?

Do you want to know if the table exists in a in SQL Server ? . Below is a sample query that lets you know if the table exists or not. How to Check if the table exists in SQL Server ? Assume that the table name is Employee , run the below query to know if the table exists in the SQL Server or…

How to Enable All Constraints back in the Database in SQL Server ?

In one of the articles , we explained How to Disable All Constraints in the Database temporarily in SQL Server ? , let’s look at the option of how to enable back the constraints in the SQL Server Database. How to Enable All Constraints back in the Database in SQL Server ? Below is a sample query that enables all the constraints back to the…

What is Normalization ?

Normalization in database is a set of technique applied to the data structures (tables) based on some predefined rules in building the database. The Normalization involves the process of organizing data in order to minimize redundancy. The Normalization generally involves splitting the database tables into multiple related tables .

What is RDBMS ?

RDBMS stands for Relational Database Management Systems . It is a database management system that helps to manage records in rows and columns in the database tables. RDBMS enables the SQL developers or administrators to create and maintain relationship between tables . Some of the typical examples of RDBMS include SQL Server Oracle MySQL PostgreSQL and more…

How to find if the Column Exists in a table in SQL Server?

If you are looking to find if the column exists in a table in SQL Server, here’s a simple query to it. Assume that the table name is “Articles” and the column name is “AbundantCodeType”, below is a sample query to know if the column exists in SQL Server. How to find if the Column Exists in a table in SQL Server ?

Equivalent of IF Statement in SQL Server

There are times when you want to perform conditional checks within a SQL Query in SQL Server . Below is a sample Query that demonstrates how to do it. Equivalent of IF Statement in SQL Server Assume that the Employee table contains a column called “Designation” and we might want to show a value 1 if the designation is SSE else show 0 . You…