SQL Proc count tables

Proc count tables

use pubs
go

if exists (SELECT * FROM sysobjects where name='count_tables' and type='P')
	DROP PROC count_tables
go

-- Simple example to illustrate output parameters
CREATE PROC count_tables @authorcount int output, @titlecount int output
as
select * from authors
select @authorcount=@@rowcount
select * from titles
select @titlecount=@@rowcount
return(0)
go

declare @a_count int, @t_count int
exec count_tables @a_count output, @t_count output
select authorcount=@a_count,titlecount=@t_count
go