Solved

select into

Posted on 2011-03-21
3
224 Views
Last Modified: 2012-08-13
what would be the syntax to select from the same table and insert
the same id lets say id  377, but all storenumbers with the same id 377 within this one table.


select storenumbers from users1
insert into users1 (storenumbers , '377')
0
Comment
Question by:sevensnake77
3 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 35180799
this should do:

insert into users1 (storenumbers , id) 
select storenumbers , '377' 
from users1 

Open in new window

0
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 35180975
insert into users1 (id,storenumbers)
select distinct 377,storenumbers
from users1
0
 
LVL 9

Author Closing Comment

by:sevensnake77
ID: 35180984
tks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
t-sql Joining Issue 10 39
why sql server only update some statistics in the database ? 3 22
TSQL query to generate xml 4 34
SQL View nearest date 5 36
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
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.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

772 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