In this post we will learn how to add multiple rows to a table with one query. Example 1: Add the authors table the authors whose names are Arthur Machen and Jack London in one query. Insert into authors (name,surname)...

# Tag - SQL Stored Procedure Examples

## Create A Stored Procedure Calculate Power Of A Number In Sql

In this example we will create a procedure that calculates power of given number. Transact-SQL Create Procedure myPower(@num int,@pow int, @result int output) As Begin Declare @i int = 0; Set @result = 1 while(@i<@pow) Begin...

## Calculating Factorial of Given Number in SQL with Stored Procedure

In this tutorial we will write “Stored Procedure” calculates the factorial of a number. That is specified at below. Transact-SQL Create procedure factor(@number int) as begin Declare @i int = 1,@result int=1 while...

## Generate Unique Random Numbers In Sql With Stored Procedure

This procedure generates random unique numbers between two numbers. It gets 3 parameters. The first parameter is number you want to list, the second parameter is the start value and the last parameter is the end value. In this...

## SQL Query to List only the Count of Female Students in Each Class

In this SQL Query Example, We’ll learn How to List only the Count of Female Students in Each Class. SQL Query: C# Select class,gender,count(*) as StudentCount from students where gender = 'F' group by gender,class 123456...

## SQL Query to List only the Count of Male Students in Each Class

In this SQL Query Example, We’ll learn How to List only the Count of Female Students in Each Class. SQL Query: C# Select class,gender,count(*) as StudentCount from students where gender = 'F' group by gender,class 123456...

## SQL Query to Display the last name of students whose Firs Name have exactly 5 characters

In this SQL Query example, i’ll show you How to Write a query to display the last name of employees whose first name have exactly 5 characters. SQL Query: C# SELECT name FROM students WHERE name LIKE '_____'; 123...

## SQL Query to Add Two Numbers With Stored Procedure

In this example,we’ll learn How to Finding The Sum Of The Two Numbers With Stored Procedure. SQL Query: Transact-SQL Create Procedure sumThree @n1 int, @n2 int, @result int output as Begin Set @result = @n1+@n2 End --To...

## SQL Query to Finding The Sum Of The Three Numbers With Stored Procedure

In this example,we’ll learn How to Finding The Sum Of The Three Numbers With Stored Procedure. Transact-SQL Create Procedure sumThree @n1 int, @n2 int, @n3 int, @result int output as Begin Set @result = @n1+@n2+@n3...

## Generate Random Number Between the Two Numbers Entered in SQL Stored Procedure

In this article we’ll learn the procedure that selects random number between the two numbers entered as parameters. Transact-SQL Create Procedure Sp_Random_Value @first int, @second int, @result int output As Begin Set @result...