Sql server
am a fresher i know how to create a table,inserting table and deleting table but i don't know how to create a stored procedure please help me..........
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Saqi60 reputationPosted Feb 20, 2013, 4:13 AM EST
there are plenty of references on youtube which you can see how to use references and forms i strongly recommend you to check first videos with practice.
thanks
Satyapriya NayakRank #47 · 31.5K reputationPosted Feb 20, 2013, 6:15 AM EST
Advantages of the stored procedure
Create table student (sid varchar(50),sname varchar(50),smarks int,saddress varchar (50),year varchar(50))
--------------------------
CREATE PROCEDURE display
AS
select * from student
-----------
CREATE PROCEDURE insert
(@sid varchar(50),@sname varchar(50),@smarks int,@saddress varchar (50),@year varchar(50))
AS
insert student(sid,sname,smarks,saddress,year) values (@sid,@sname,@smarks,@saddress,@year)
---------------------
CREATE PROCEDURE update
(@sid varchar(50),@sname varchar(50),@smarks int,@saddress varchar (50),@year varchar(50))
AS
update student set sname=@sname,smarks=@smarks,saddress=@saddress,year=@year where sid=@sid
-------------
CREATE PROCEDURE delete
(@sid varchar(50))
AS
delete from student where sid=@sid
Refer
http://www.mssqltips.com/sqlservertutorial/160/sql-server-stored-procedure/
http://csharp-station.com/Tutorial/AdoDotNet/Lesson07
http://www.codeproject.com/Articles/179481/Code-First-Stored-Procedures
http://www.codeproject.com/Articles/414/Tutorial-on-Extended-Stored-Procedures-for-MS-SQL
Santosh YadavRank #6,715 · 258 reputationPosted Feb 20, 2013, 8:14 AM EST
student (table name) and fields are :
1). student_id
2). student_name
3). student_age
now you want to create a stored procedure to insert records into table then.
Syntax :
create proc usp_studentInsert
(
@studentid varchar(10),
@student_name varchar(50),
@student_age varchar(5)
)
as
insert into student(student_id,student_name,student_age)
values(@studentid,@student_name,@studentage);
Note :
Here, @studentid,@student_name,@studentage are the parameters which you have to pass when you will use this procedure to insert data into table.