SELECT * INTO table IN db
SELECT * INTO table IN db
(OP)
I am using SQL 2k.
I have two db (db1 and db2) on the server SERVER1.
Table1 is in db1.
I want to create a copy of table1 in table2 on db2..
use db1
select * into table2 in db2
from table1
gives me 'incorrect syntax near the keyword 'IN'.
The examples I found online say I have to do 'db2.db' or 'db2.mdb' ... Is that a reference to a file? I don't want to run something I don't understand..
I have two db (db1 and db2) on the server SERVER1.
Table1 is in db1.
I want to create a copy of table1 in table2 on db2..
use db1
select * into table2 in db2
from table1
gives me 'incorrect syntax near the keyword 'IN'.
The examples I found online say I have to do 'db2.db' or 'db2.mdb' ... Is that a reference to a file? I don't want to run something I don't understand..
Tao Te Ching Discussions : Chapter 9 (includes links to previous chapters)
What is the nature of conflict?
RE: SELECT * INTO table IN db
So, please, post in a SQL Server forum.
forum183: Microsoft SQL Server: Programming
Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?
RE: SELECT * INTO table IN db
forum183: Microsoft SQL Server: Programming
However, the answer to your question is the following:
CODE
SELECT * INTO db2.dbo.Table2
FROM Table1
Replace dbo with the name of another schema if needed.
RE: SELECT * INTO table IN db
Thanks for the answer!
Tao Te Ching Discussions : Chapter 9 (includes links to previous chapters)
What is the nature of conflict?
RE: SELECT * INTO table IN db
RE: SELECT * INTO table IN db
FAQ220-1073: What is ANSI SQL? Why This Forum?
Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?
RE: SELECT * INTO table IN db
SELECT INTO, for example, is ~not~ ANSI SQL
r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
RE: SELECT * INTO table IN db
Tao Te Ching Discussions : Chapter 9 (includes links to previous chapters)
What is the nature of conflict?
RE: SELECT * INTO table IN db
1. CREATE TABLE db2.dbo.Table2 ( ...
2. INSERT INTO db2.dbo.Table2 SELECT ... FROM db1.dbo.table1
r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
RE: SELECT * INTO table IN db
Tao Te Ching Discussions : Chapter 9 (includes links to previous chapters)
What is the nature of conflict?