Monday, January 28, 2013 8:35 PM
Please i am testing out an SSIS package i designed and i need to write a script that will insert data dummy data into my SQL tables. These tables have a date column that i will like to add an incremental date values into. I want the insert to be done every 5mins with new sets of data into these tables.
Can someone assist me here.
Tuesday, January 29, 2013 4:38 AM
The following T-SQL will insert 5 test rows based on the current time less incrementing minutes going back 4 minutes giving 5 rows of test data. You can put this in a SQL Server Agent job and schedule it to run every 5 minutes. Anyway its a rough guide as to how to proceed and should get you started, obviously just replace the temp table with the table you wish to use...
Declare @counter int -- Example test data table Create table #testdata ( Id int identity(1, 1) Not Null, SomeText varchar(50) Not Null, InsertDate Datetime Not Null, Primary Key(Id) ) Set @counter = 0 -- Insert 5 rows of test data... While @counter <= 4 Begin --Insert Every 5 mins Insert Into #testdata(SomeText, InsertDate) Values ('Test Data', DateAdd(MINUTE, -@counter, GetDate())) Set @counter = @counter + 1 End
- Marked As Answer by Eileen ZhaoMicrosoft Contingent Staff, Moderator Friday, February 08, 2013 6:57 AM