use sybsystemprocs
go

if object_id('sp_days') is not NULL
    drop proc sp_days
go

create proc sp_days @days tinyint OUTPUT, @month tinyint, @year smallint
as
  declare @date datetime
  select @date=convert(char,@month)+'/01/'+convert(char, @year)
  select @days=datediff(dd,@date, dateadd(mm,1,@date))
  select @days
go

grant exec on sp_days to public
go