Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Movva
Starting Member
15 Posts |
Posted - 2013-04-01 : 15:37:57
|
Hi there, I am trying to back up a table to another Common db. Here is the sql but for some reason it says that 'Incorrect syntax near IN'. I am using SQL Server 2012.select *INTO TableB IN 'Common.mdb'from TableAThanks,Dev |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2013-04-01 : 15:48:06
|
In sql server if you want to refer to a table in a database other than the database your code is executing then use dot notation to qualify the table (<database>.<schema>.<table>). ie: use myDatabaseselect *INTO common.dbo.TableBfrom TableA Be One with the OptimizerTG |
|
|
Movva
Starting Member
15 Posts |
Posted - 2013-04-01 : 15:54:25
|
Figured this out.. the below works fine and I see it create a table in Common DB on the same server.select *INTO Common.dbo.TableB from TableA |
|
|
Movva
Starting Member
15 Posts |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2013-04-01 : 16:54:17
|
>>when do we use IN keyword as explained in the above link.That link is not specific to MS SQL Server and that usage will not work in sql server. So I would have to say, "never" .For online help with ms sql server I strongly suggest you use Books OnlineBe One with the OptimizerTG |
|
|
|
|
|