New Zealand
Goldriver & Glentreve
  Golden Retrievers
 

Home Page

About Us

News

Our Boys

Our Girls

Our Corgis

Owned by Others

Memories

Contact Us

Links

 

Goldriver
Email: Marilyn Black
marilyn.b@pumpmachinery.co.nz
Waikanae  
Kapiti Coast   
New Zealand
Ph:04 2938386

Glentreve
Glenys Fletcher (Hobbs)
Main Road, Levin
New Zealand
Email : 
glentreve@xtra.co.nz

Ph: 06-3672221

 

 

canada goose junior france 2015

 
 

canada goose junior france 2015

To accomplish data generator using T-SQL
Some times DBAs want to generate test data to test some applications designed and developed by themselves, canada goose expedition xxs outlet . I have faced many situations like this in past buy canada goose junior france 2015 . Recently also I had to generate some test data to test one of my research projects. Below is the ERD of the application. It is just four tables.

I used AdventureWorks2012 database to load data into Customer and Item. I did not bother to write a script for this since it is pretty straight forward, buy canada goose parka online 2015 . The challenge was to generate data for SalesOrder and SalesOrderDetail canada goose junior france 2015 . I used RAND() function throughout the script canada goose junior france 2015 cheap . You could simply use “GO n” where n is the no. of iterations you want to execute the script canada goose junior france 2015 . This will simply load large data set quickly. You could customize the script to suite your requirement purchase canada goose junior france 2015 .

--Test data generator
--Generate Sales Order data
--Date. 10/20/2012

SET NOCOUNT ON
--declare local variables
DECLARE @OrderID int
@Customer_PK int
@Amount money
@NoofOrderItems tinyint
@loop tinyint
@strSQL nvarcharmax

--get random Order amount
SET @AmountROUNDCASTRAND() * 1000 AS money). 2
--get random Customer
SET @Customer_PKISNULLSELECT Customer_PK from Customer WHERE Customer_PKROUNDCASTRAND() * 100 AS int). 0)*3). 1

--insert to Orders
INSERT dboSalesOrder OrderDateAmountCustomer_PK
VALUES GETDATE@Amount@Customer_PK

SET @OrderIDSCOPE_IDENTITY

SET @NoofOrderItemsROUNDCASTRAND() * 10 AS int), canada goose youth outlet cheap . 0

IF @NoofOrderItems
SET @NoofOrderItems

SET @strSQL'INSERT dbo. SalesOrderDetail (Order_PK. Item_PK. Qty canada goose junior france 2015 . UnitPrice) VALUES '

SET @loop
WHILE @loop@NoofOrderItems
BEGIN

IF @loop
SET @strSQL@strSQL CONVERTvarchar(10). @OrderID) + '. (SELECT ISNULL((SELECT ISNULL(Item_PK canada goose junior france 2015 sales . 1) from Item WHERE Item_PK=ROUND(CAST(RAND() * 100 AS int) canada goose fur shedding for sale . 0)*3). 1)). CAST(RAND() * 100 AS int). ROUND(CAST(RAND() * 100 AS money). 2)*2)'
ELSE
SET @strSQL@strSQL CONVERTvarchar(10). @OrderID) + '. (SELECT ISNULL((SELECT ISNULL(Item_PK canada goose chilliwack windswept for sale . 1) from Item WHERE Item_PK=ROUND(CAST(RAND() * 100 AS int) discount canada goose sale store online . 0)*3) canada goose down fill count 2015 . 1)). CAST(RAND() * 100 AS int). ROUND(CAST(RAND() * 100 AS money). 2)*2)'

SET @loop@loop

END

EXEC sp_executesql @strSQL. canada goose junior france 2015


 

 
 

[Refresh/Reload]

Hit Counter

Images & Text in this site are Copyright - DO NOT COPY!

Web By DogWebs.Biz

EDIT