Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 642537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:10:58+00:00 2026-05-13T21:10:58+00:00

Following is the sample data. I need to make 3 copies of this data

  • 0

Following is the sample data. I need to make 3 copies of this data in t sql without using loop and return as one resultset. This is sample data not real.

42  South Yorkshire
43  Lancashire
44  Norfolk

Edit: I need multiple copies and I have no idea in advance that how many copies I need I have to decide this on the basis of dates. Date might be 1st jan to 3rd Jan OR 1st jan to 8th Jan.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:10:58+00:00Added an answer on May 13, 2026 at 9:10 pm

    Don’t know about better but this is definatley more creative! you can use a CROSS JOIN.
    EDIT: put some code in to generate a date range, you can change the date range, the rows in the #date are your multiplier.

      declare @startdate datetime
    , @enddate datetime
    create table #data1 ([id] int , [name] nvarchar(100))
    create table #dates ([date] datetime)
    
    
    INSERT #data1 SELECT 42,  'South Yorkshire'
    INSERT #data1 SELECT 43,  'Lancashire'
    INSERT #data1 SELECT 44,  'Norfolk'
    
    
    set @startdate = '1Jan2010'
    set @enddate = '3Jan2010'
    
    WHILE (@startdate <= @enddate)
    BEGIN   
    INSERT #dates SELECT @startdate
    set @startdate=@startdate+1
    END
    
    
    SELECT [id] , [name] from #data1 cross join #dates
    
    drop table #data1
    drop table #dates
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

1I have the following two tables (sample data) and need to be able to
Following is the sample data set that I need to group together, if you
I'm using XOM with the following sample data: Element root = cleanDoc.getRootElement(); //find all
Imagine the following schema and sample data (SQL Server 2008): OriginatingObject ---------------------------------------------- ID 1
I have the following sample data: Id Name Quantity 1 Red 1 2 Red
How can you use the following sample data either with a foreach or while
I have the following sample of data to insert into tables(from parent to child,
For my question lets consider the following sample table data: ProductID    ProductName    Price   Category 1                Apple                 5.00       Fruits
Currently trying to figure out how best to process the following sample XML data:
I have the following simple class Data annotation to control the area of phone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.