[dba-SQLServer] Filling Table with Range of Dates

Billy Pang tuxedo_man at hotmail.com
Mon Oct 18 23:19:52 CDT 2004


how about..

1. create a temporary table that contains identity column.

2. insert one record into that temporary table.

3. execute X number of insert statements with "select" as source of the 
table you just created (therefore, number of records will insert by two 
folds per insert execution).

4. when you are satisified with number of records in temporary table, write 
a final insert statement containing dateadd function with identity column as 
one of the parameters.

hth
Billy


>From: David Emerson <davide at dalyn.co.nz>
>Reply-To: dba-sqlserver at databaseadvisors.com
>To: dba-SQLServer at databaseadvisors.com
>Subject: [dba-SQLServer] Filling Table with Range of Dates
>Date: Tue, 19 Oct 2004 13:20:42 +1300
>
>SQL2000
>
>I have a table that I would like to fill in with a range of dates.  Is 
>there a simple insert statement that I can do this easily, or do I need to 
>write a loop and run a separate insert for each date?
>
>Regards
>
>David Emerson
>Dalyn Software Ltd
>25 Cunliffe St, Churton Park
>Wellington, New Zealand
>Ph/Fax (04) 478-7456
>Mobile 027-280-9348
>
>_______________________________________________
>dba-SQLServer mailing list
>dba-SQLServer at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>http://www.databaseadvisors.com
>





More information about the dba-SQLServer mailing list