How to add dummy Data in a sql server table
Microsoft Net Framework

How to add dummy Data in a sql server table

 

1) Write Query that will insert data in a table

 

INSERT [dbo].[Ads] ( [ReferenceNumber], [AdName], [AdDescription], [City_Id], [Model_Id], [Year], [TransmittionType], [Color], [FuelType], [RegionalSpecs], [MortgageDetails], [AskingPrice], [MileageKM], [IsFeatured], [Account_Id], [AdStatus_Id], [TicketsQuantity], [RemainingTicketsQuantity], [CreatedDate], [ExpiryDate], [TicketPrice], [AboutWarrenty], [BodyType], [ServiceHistory], [DeleteReason], [MulkiyaFrontURL], [MulkiyaBackURL], [OwnershipDocumentURL], [OwnershipType], [IsUserFavouirte]) VALUES (N'WD-1492555', N'Audi  for sale', N'Description', 2, 432, 2010, N'Automatic Transmission', N'Silver', N'Diesel', N'Japanese Specs', NULL, CAST(10000.00 AS Decimal(18, 2)), 123, 1, 133, 1, 600, 598, CAST(0x0000A8CB01187186 AS DateTime), CAST(0x0000A8D2013A36E0 AS DateTime), CAST(25.00 AS Decimal(18, 2)), N'Yes', N'Sports Car', 1, NULL, NULL, NULL, N'6366006006380526061.pdf', N'otherOwnershipDoc', NULL)

 

2) Create  a while loop that will  repate that query

 

DECLARE @i int = 0

 

WHILE @i < 20

BEGIN

    SET @i = @i + 1

    /* do some work */

END

 

 

3) merg result will be  below

 

 

 

 

DECLARE @i int = 0

 

WHILE @i < 20

BEGIN

    SET @i = @i + 1

    /* do some work */

 

INSERT [dbo].[Ads] ( [ReferenceNumber], [AdName], [AdDescription], [City_Id], [Model_Id], [Year], [TransmittionType], [Color], [FuelType], [RegionalSpecs], [MortgageDetails], [AskingPrice], [MileageKM], [IsFeatured], [Account_Id], [AdStatus_Id], [TicketsQuantity], [RemainingTicketsQuantity], [CreatedDate], [ExpiryDate], [TicketPrice], [AboutWarrenty], [BodyType], [ServiceHistory], [DeleteReason], [MulkiyaFrontURL], [MulkiyaBackURL], [OwnershipDocumentURL], [OwnershipType], [IsUserFavouirte]) VALUES (N'WD-1492555', N'Audi  for sale', N'Description', 2, 432, 2010, N'Automatic Transmission', N'Silver', N'Diesel', N'Japanese Specs', NULL, CAST(10000.00 AS Decimal(18, 2)), 123, 1, 133, 1, 600, 598, CAST(0x0000A8CB01187186 AS DateTime), CAST(0x0000A8D2013A36E0 AS DateTime), CAST(25.00 AS Decimal(18, 2)), N'Yes', N'Sports Car', 1, NULL, NULL, NULL, N'6366006006380526061.pdf', N'otherOwnershipDoc', NULL)

 

/**/

END

 

 

Share This with your friend by choosing any social account


Upcoming Articles
You may also read following recent Post
Copyright Future Minutes © 2015- 2024 All Rights Reserved.   Terms of Service  |   Privacy Policy |  Contact US|  Pages|  Whats new?
Update on: Dec 20 2023 05:10 PM