Deccansoft Software Service-SQl Server
EXEC SpGeiAllEmp Print ‘Sum of two numbers is’+ convert(varchar,@rl)
Parameter */
CREATE PROCEDURE SpinseriCustomer (@Custld int OUTPUT ,@Cname varchar(15}
varchar(15))
AS
Insert into customer valties(@Cname/@Add)
Select @Custld=@@identity
| To Execute:
| Declare @ld int
| execute InsertCustomer @Id output, Martin’ 2000
Print ‘Customer number is !+ convert(varchar,@Id)
/*This Procedure Update Salar
rows *!
CREATE PROCEDUE SpUpdateEEmployee
AS
Update Employee
Set Salary=Salary+500
Where fideptld =30 om
retum @@roweount f
To Execute: 7
Declare @no int pats rr
| EXEC @no = SpUpdateEmployee
| Print @no)
RAISERROR
'* Stored Provedures ean raise errors to the front end application:
‘+ If Error isGustony error message it is a assigned a number 50000,
+ RAISERROR message, severity, state
Severity ma inghe range of 11 to 19.
Ex: RAISERROR (‘Some Message Here’. 11, 1)
Srey rocear SpinsertOrders(@CId int, @ODate datetime) AS
BEGIN
IF EXISTS S Weeigd * fiom customer where PKCustomerid =@Cid)
BEGIN
Insert into Orders values(@CId,@Odate)
END
ELSE
RaisError( ‘Customer does not exists'11,1)
return
19