
use pubs
go

dbcc freeproccache
go

create function getauthors1(@name varchar(40))
returns table 
AS
return
( SELECT au_id, au_lname, au_fname FROM dbo.authors where au_lname = @name )
go

select * from pubs.dbo.getauthors1('ringer')
go

select * from pubs.dbo.getauthors1('smith')
go

create function getauthors2(@name varchar(40))
returns table 
with schemabinding
AS
return
( SELECT au_id, au_lname, au_fname FROM dbo.authors where au_lname = @name )
go

select * from pubs.dbo.getauthors2('ringer')
go

select * from pubs.dbo.getauthors2('smith')
go
