Return to Snippet

Revision: 65523
at December 12, 2013 07:16 by kidmizere


Initial Code
declare @imax INT,
		@i INT
	SET @imax = 400 -- change to max value
    SET @i = 1 
    
while (@i <= @imax)
	Begin
	Insert into Workflow_status 
	(WF_date)values (convert(date, getdate() + @i,101))
	SET @i = @i + 1 
	
END

Initial URL


Initial Description
This loop adds a bunch of records to your database with a date field pre-populated. Works well for pre-populating a table for filling out daily by a form

Initial Title
Add dated records to MSSQL using while loop

Initial Tags


Initial Language
SQL