Solved

Duplicate lines in a SQL table

Posted on 2013-05-17
2
410 Views
Last Modified: 2013-05-17
Hi

I have a SQL table called Transactions with a field Transaction ID. I want to duplicate lines with a certain TransactionID. What SQL statement would I use to do this?
0
Comment
Question by:murbro
2 Comments
 
LVL 15

Accepted Solution

by:
Aaron Shilo earned 500 total points
ID: 39176744
insert into Transactions
select * from Transactions
where Transactionid = id

OR

insert into Transactions
select * from Transactions
where Transactionid in (id,id,id)
0
 

Author Closing Comment

by:murbro
ID: 39176755
Thanks
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SLQ View not updating 10 47
Numeric sequence in SQL 14 38
Access recordset not updateable 8 39
SQL - Join 2 Tables Based on Ranges 8 10
Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now