use pubs
go
select * from titles where type='business'
go
create proc P_Titles_ByType
@type char(12)
as
select * from titles where type=@type
go
exec P_Titles_ByType @type='business'
go
exec P_Titles_ByType 'business'
go
select * from titles
where type='business' and price>10
go
create proc P_Titles_ByTypeAndPrice
@type char(12),
@price money
as
select * from titles
where type=@type and price>@price
go
exec P_Titles_ByTypeAndPrice
@type='business',@price=10
go
exec P_Titles_ByTypeAndPrice
@price=10,@type='business'
go
exec P_Titles_ByTypeAndPrice 'business',10
go
use pubs
go
select * from titles
select price from titles where title_id='BU1032'
go
create proc P_Titles_ByTitleID_SelectPrice
@title_id varchar(6)
as
select price from titles where title_id=@title_id
go
exec P_Titles_ByTitleID_SelectPrice 'BU1032'
go
create proc P_Titles_ByTitleID_SelectPrice2
@title_id varchar(6),
@price money output
as
select @price=price from titles where
title_id=@title_id
go
declare @price2 money
exec P_Titles_ByTitleID_SelectPrice2
@title_id='BU1032',
@price=@price2 output
select @price2