Alexander Rodriguez
Alexander Rodriguez

Reputation: 9

How to insert values to another database?

How can I import or insert the result of this query to another database?

SELECT * FROM TBL_SALES

Upvotes: 1

Views: 34

Answers (1)

Thom A
Thom A

Reputation: 96004

Use 3 part naming (you should be using 2 part already). In Pseudo terms:

INSERT INTO YourDatabase.YourSchema.YourTable ({Column List})
SELECT {ColumnList}
FROM dbo.TBL_SALES; --I assumed your table was on dbo.

Upvotes: 1

Related Questions