piyush prajapati
piyush prajapati

Reputation: 13

How to transfer data from one table of a database to a table in another database

I want to transfer data from a table of one database to a table in another database, For that I wrote this SQL

INSERT INTO 3tier-loginmodule-linq..tbl_rolll(Roll_id,Roll_Name)
   SELECT 
       Roll_id, Roll_Name 
   FROM 
       LoginMaster..tbl_roll;    

But I get an error

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '3'.

Upvotes: 1

Views: 157

Answers (1)

BICube
BICube

Reputation: 4681

Use square brackets around object's names

INSERT INTO [3tier-loginmodule-linq].....etc

Or use double quotes as suggested in the comment

INSERT INTO "3tier-loginmodule-linq".....etc

Upvotes: 3

Related Questions