Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Stored Procedure
WhatsApp
Burak Seyhan
Feb 09
2015
1.2
k
0
0
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
Up Next
Stored Procedure