Can you give an example of Stored Procedure?

Answer Posted / madhesan

create database mani

use mani

create table emp
(
empno int,
empname varchar(20),
salary int
)

select * from emp

insert into emp values(2,'hari',10000)

create procedure selectproc
as select * from emp

exec selectproc

create procedure insertproc
@no int,
@name varchar(20),
@salary int
as
insert into emp values(@no,@name,@salary)

exec insertproc1 2,'pavan',15000

create procedure insertproc1
@no int,
@name varchar(20),
@salary int
as
if @no=1
print 1
else
insert into emp values(@no,@name,@salary)
print "successfully inserted!!!"

select * from syscolumns

sp_helpdb mani

sp_help selectproc
sp_helptext selectproc

set isolation level serializable

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a database be shrunk to 0 bytes, if not, why?

634


What are different types of collation sensitivity?

531


can a database be shrunk to 0 bytes, if not, why? : Sql server administration

590


Which Model uses the SET concept

566


Can a trigger be created on a view?

559






Tell me in brief how sql server enhances scalability of the database system?

511


Where can you add custom error messages to sql server?

569


If the job running very slow what is the action you do

1416


What do you understand by sql server agent?

519


What happens if null values are involved in boolean operations?

547


What are the advantages of passing name-value pairs as parameters?

647


What is the fastest way to permanently delete a 1 million row table named customers?

584


How to defragment table indexes?

540


What are the different types of normalization?

607


What is the difference between a "where" clause and a "having" clause?

603