TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Stored Procedure
Burak Seyhan
Feb 09
2015
Code
1.1
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
Create
Proc uspDemoInsert
-- Insert Operation
(
@FirstName nvarchar(25),
@LastName nvarchar(25),
@Age
int
)
as
begin
insert
Customer(FirstName,LastName,Age)
values
(@FirstName,@LastName,@Age)
end
exec
uspDemoInsert
'Burak'
,
'Seyhan'
,23
-- Execute insert procedure
go
Create
Proc uspDemoSelect
-- Select operation
as
begin
Select
*
from
Customer
end
exec
uspDemoSelect
-- Execute select procedure
go
Create
Proc uspDemoUpdate
-- Update Data
(
@Id
int
,
@FirstName nvarchar(25),
@LastName nvarchar(25),
@Age
int
)
as
begin
Update
Customer
set
Age=@Age,FirstName=@FirstName,LastName=@LastName
where
Id=@Id
end
exec
uspDemoUpdate 7,
'ChangedName'
,
'LastName'
,33
-- execute update procedure
go
Create
Proc uspDemoDelete
(
@Id
int
)
as
begin
Delete
from
Customer
where
Id=@Id
end
exec
uspDemoDelete 4
-- execute delete procedure
SQL
Stored Procedure