Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

sql 2008 query - search/copy tables results

SQL 2008 Management Studio

What I am trying to do is as follows:

1. search a table (multiple results will come back)
2. copy that tables row/record and create a new row/record in the same table -- basically cloning the information (but change a couple of columns within table with a static value).

How is type of query written in SQL please?
SELECT MasterAccount_ID, DisplayNameApp1
FROM MasterAccounts
WHERE LeadSourceProvider_ID=143

Open in new window

0
amillyard
Asked:
amillyard
  • 2
1 Solution
 
lofCommented:
insert into TableName (column1, column2)
select column1, column2 from Tablename
where [your conditions here]
0
 
lofCommented:

INSERT INTO MasterAccounts (MasterAccount_ID, DisplayNameApp1)
SELECT MasterAccount_ID, DisplayNameApp1
FROM MasterAccounts
WHERE LeadSourceProvider_ID=143

Open in new window

0
 
amillyardAuthor Commented:
Excellent - thank you :-)
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now