First Create to Table :
Table Name "DistMast" ,Field : Distcode numeric (12), Distname varchar(5)
Create table Reference Link : Click Me
Syntax :
Create procedure ProcName
as
begin
--- Your Query
----should be return here
end
Execute the stored procedure
Exec ProcName
Example
Create Procedure DistMast_SP(
@DistCode NUMERIC(10),
@DistName VARCHAR(50),
@Param VARCHAR(10))
AS
Begin
IF @Param='I'
BEGIN
INSERT INTO CurMast(DistCode,DistName)
VALUES(@DistCode,@DistName)
END
ELSE IF @Param='U'
BEGIN
update DistMast set DistName=@DistName
where Distcode=@DistCode
where Distcode=@DistCode
END
ELSE IF @Param='D'
BEGIN
Delete from DistMast where DistCode=@DistCode
END
End
Execute Procedure
Exce DistMast_SP
No comments:
Write comments