Categories
Sql Server

What is difference between Delete and Truncate

What is difference between Delete and Truncate Truncate and Delete both will be used to delete data from a table.Both the SQL statements are used to delete only the data from table but both are differ from each other in many area like syntax, performance, resource uses. Truncate The TRUNCATE command in SQL removes all rows from a […]

Categories
Sql Server

What are Triggers in Sql server and types of Triggers

Triggers:- Trigger is a special kind of stored procedure they executes themselves when an INSERT, UPDATE, or DELETE statement modifies the data in table. A trigger can query other tables as well and we can create complex Transact-SQL statements. We often create triggers to enforce referential integrity or consistency among logically related data in tables.You […]

Categories
Sql Server

Default Constraint In SQL Server

Default Constraint In SQL Server DEFAULT constraint is used to insert a default value into a column ,that is predefined by us. Query to create a DEFAULT constraint:- CREATE TABLE sales_order ( Id int NOT NULL, O_No int NOT NULL, OrderDate date DEFAULT GETDATE(),city varchar(50) ) Create a default constraint in already created table:- ALTER […]

Categories
Sql Server

How to create CHECK Constraint in Sql server

CHECK Constraint in Sql server CHECK constraint is to limit the value range that can be inserted in a column. If you define a CHECK constraint on a single column it allows only certain values for this column that you are defined with in check constraint. Query To create CHECK constraint:- CREATE TABLE hightech ( […]