Ap 7 Traslator

Wednesday, June 8, 2016

http://saipathrikar.blogspot.in/
In a database management system (DBMS), a stored procedure is a set of Structured Query Language (SQL) statements with an assigned name that's stored in the database in compiled form so that it can be shared by a number of programs. The use of stored procedures can be helpful in controlling access to data (end-users may enter or change data but do not write procedures), preserving data integrity (information is entered in a consistent manner), and improving productivity (statements in a stored procedure only need to be written one time).

<<Free text search Storeprocedure>>
Cretae PROCEDURE [dbo].[Sp_FreetextSearchForSch_Email]
(

@Email_ID varchar(max)

)
as
select Email_ID from Tbl_Schedule  where Email_ID like '%'+@Email_ID+'%' return


<<All Multiple Operation In Single StoreProcedure>>
create procedure [dbo].[SP_Allinone]
(
@ID int,
@Name varchar(max),
@Add varchar(max),
@Status varchar(max)


)

as
begin
if @Status='Insert'
Begin
insert Tbl_Demo (ProductId,Productname,Price) values (@ID,@Name,@Add)
end
else if @Status='Update'
begin
Update Tbl_Demo set Productname=@Name,Price=@Add where ProductId=@ID
end
else if @Status='Delete'
begin
Delete from Tbl_Demo where ProductId=@ID
end
else if @Status='Select'
begin
Select * from Tbl_Demo where ProductId=@ID
end
end




This video is very helpfull for reffrance

No comments: