How To Create a Large Table with Random Data for Index Testing in MS SQL Server?

June 30, 2011

If you want to see how index can be used to improve data search performance, you have to build some large tables, which requires large amount of random data. This tutorial exercise helps you to build a large table with pure random data:

USE GlobalGuideLineDatabase;
GO

– Drop the old table, if needed
DROP TABLE ggl_random;
GO

– Create a table with primary key
CREATE TABLE ggl_random (
id INT,
rand_integer INT,
rand_number numeric(18,9),
rand_datetime DATETIME,
rand_string VARCHAR(80)
);
GO

Related Interview Questions:

  1. How To Generate Random Numbers with the RAND() Function in MS SQL Server?
  2. How to recreate the index on a Firebird table?
  3. How to select a random record from a table?
  4. How To Generate CREATE TABLE Script on an Existing Table in MS SQL Server?
  5. How To Generate CREATE TABLE Script on an Existing Table in MS SQL Server?

{ 1 comment… read it below or add one }

Jayan January 9, 2012 at 11:08 am

At last! Something clear I can udnetsrand. Thanks!

Reply

Leave a Comment

Previous post:

Next post: