Hi Enrico
Thanks for buying the book, and taking the time to work thru the examples.
Here is the GetDOB SP
If you find anymore SPs are missing please let me know, and I'll try and get them posted here a bit faster next time.
USE [People]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[GetDOB] @DOB datetime output as
begin
-- generate DOB's
declare @dayofYear int, @yearOffset int, @BaseYear int, @startDate varchar(12) -- , @DOB datetime
select @BaseYear = 2006 - 110
select @dayOfYear = rand() * 365, @yearOffset = rand() * 110
select @startDate = '1 Jan ' + convert(varchar(4),(@BaseYear + @yearOffset))
select @DOB = dateadd(dd,@dayOfYear,@startDate)
end
Steve Wort
Co Author "Professional SQL Server 2005 Administration"
|