May 30, 2010 at 2:48 pm
Hi,
I want test live migration feature of SQL Serve 2008 R2 and for which I need a script which inserts data continuously in a loop. Please advice.
Thanks
May 30, 2010 at 4:45 pm
Please be a little more specific regarding the table/data structure you want to insert.
Otherwise, you might see a script like the following to enter a few thousand rows into a table:
SELECT number
INTO target_table
FROM master..spt_values where type='P'
I'm not sure if that's what you're looking for though...
May 31, 2010 at 10:35 am
Thanks you,
I just want to create a new table and insert data in loop using a query from management studio and want to see while performing live migration, whether the migration interrupts the query running from Management studio or not.
please advice
thanks
June 1, 2010 at 11:29 am
Is this what you want?
CREATE TABLE [Test] (col1 bit)
WHILE 1=1
BEGIN
INSERT INTO [Test] VALUES (1)
END
DROP TABLE [Test]
Regards,
Marco
June 1, 2010 at 11:37 am
CREATE TABLE [Test] (col1 bit)
DECLARE @endDate datetime
SET @endDate = DATEADD(hh,8,GETDATE()) -- 8 hours from now
WHILE GETDATE() < @endDate
BEGIN
INSERT INTO [Test] VALUES (1)
END
DROP TABLE [Test]
Lowell
June 1, 2010 at 12:10 pm
Lowell (6/1/2010)
CREATE TABLE [Test] (col1 bit)DECLARE @endDate datetime
SET @endDate = DATEADD(hh,8,GETDATE()) -- 8 hours from now
WHILE GETDATE() < @endDate
BEGIN
INSERT INTO [Test] VALUES (1)
END
DROP TABLE [Test]
Are you really recommending to run that code?
Assuming the performance of my PC it would generate a few hundred million rows... :pinch:
(side note: I used a 10sec loop and extrapolated the result...)
June 1, 2010 at 12:48 pm
The poster wants to know if the migration interrupts the insert query which is running. This was a query which continuously inserts data.
You can also immediately delete the data after the INSERT stament. (and change recovery model of the database to SIMPLE)
CREATE TABLE [Test] (col1 bit)
DECLARE @endDate datetime
SET @endDate = DATEADD(hh,8,GETDATE()) -- 8 hours from now
WHILE GETDATE() < @endDate
BEGIN
INSERT INTO [Test] VALUES (1)
DELETE FROM [Test]
END
DROP TABLE [Test]
Regards,
Marco
June 1, 2010 at 9:53 pm
thanks all,
it helped me and I just added wait for delay 2 sec
CREATE TABLE [Test] (ID bit)
DECLARE @endDate datetime
SET @endDate = DATEADD(hh,1,GETDATE()) -- 1 hours from now
WHILE GETDATE() < @endDate
BEGIN
INSERT INTO [Test] VALUES (1)
WAITFOR DELAY '00:00:02';
END
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply