View Single Post
 
Old May 1st, 2007, 09:10 AM
steven_wort steven_wort is offline
Wrox Author
 
Join Date: Dec 2006
Location: kirkland, wa, USA.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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"