create table from another table in different database in sql server 2005

Posted by Greg on Stack Overflow See other posts from Stack Overflow or by Greg
Published on 2010-06-06T07:38:07Z Indexed on 2010/06/06 7:42 UTC
Read the original article Hit count: 366

Filed under:
|
|
|
|

Hi,

I have a database "temp" with table "A". I created new database "temp2". I want to copy table "A" from "temp" to a new table in "temp2" . I tried this statement but it says I have incorrect syntax, here is the statement:

CREATE TABLE B IN 'temp2'
  AS (SELECT * FROM A IN 'temp');

Here is the error:

Msg 156, Level 15, State 1, Line 2 Incorrect syntax near the keyword 'IN'. Msg 156, Level 15, State 1, Line 3 Incorrect syntax near the keyword 'IN'.

Anyone knows whats the problem?

Thanks in advance,

Greg

© Stack Overflow or respective owner

Related posts about sql

Related posts about database