Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Search In

SQL : How to check if a stored procedure exists before creation?

In this article we will learn how to check if a stored procedure exists before creating it. We can use the below script which will drop the proc if it exists and then recreate it. IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'sp

To Run Stored Procedure everyday

For doing that we need to create procedure first and also define the repeating interval to call it again We will create procedure named getnotification from the particular database that gets fired after 3:30 hours on a daily basis. When we gets

ALIAS Keyword

ALIAS Keyword: It is used to give temporary names to table and columns. It is very useful for situations where column or table names are too long. Synatx: SELECT columnname AS alias_name FROM tablename; This syntax is used for giving te

Indexes in SQL

To provide searching optimization we need to create indexes in the table. By default primary key is already indexed For searching by other columns apart from primary key we will create index into them for faster searching. Ex: CREATE INDEX na

To Create and Drop Primary and Foreign Key Constraint in SQL

In SQL we can create the primary key Ex: create table student ( stid int primary key identity(1,1), stname varchar(50) ) In SQL we can also create the foreign key using SQL query Ex: create table account ( staccid int primary ke

  • 191
Triggers associated with a table

Triggers in SQL of a table can be find by writing a SQL query and passing table name as its parameter for the query We will just pass the table name for that and it will provide all the triggers made for that table. Ex: select so.name, text fro

To insert values to identity column in SQL Server

Identity field is usually used as a primary key. When you insert a new record into your table, this field automatically assign an incremented value from the previous entry. Ex: CREATE TABLE Customer ( ID int IDENTITY,

  • 288
Try Catch in SQL

SQL Server has an exception model to handle exceptions and errors that occurs in SQL statements. To handle exception in Sql Server we have TRY..CATCH blocks. In Sql Server, against a Try block we can have only one CATCH block. Ex; BEGIN TR

Remove duplicate records from a table in SQL Server

Sometimes we required to remove duplicate records from a table although table has a UniqueID Column with identity. Ex: CREATE TABLE dbo.Employee ( EmpID int IDENTITY(1,1) NOT NULL, Name varchar(55) NULL, Salary decimal(10, 2

Copy and create temp table from main table

In SQL we have situations, where we want to manipulate our data based on conditions . For doing that one approach we need is to store that data into temp table then manipulate it. For doing this we copy the entire structure of the main table in

1 7 54
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: