Hi every body
I have 2 databases called Tax and News
There is a table in database Tax called table table1(id, Title,Content)
There is a table in database News called table table2(id, Headline,Body)
How can I copy(append) data from table1 to table2 with mapping Title -> Headline and Content -> Body
Any answers would be appreciated.
INSERT INTO table2(id, Headline, Body)
SELECT id, Title, Contents
FROM table1
(WHERE...) <-- Maybe you don't need this, if you want to insert all values.
Hope this works. If not, please write back...
|||Himartinhn
I mean two tables from two differences database (Tax db and News db).
how can I do that?
|||a4nsd:
I mean two tables from two differences database (Tax db and News db).
INSERT INTONews.dbo.table2(id, Headline, Body)
SELECT id, Title, Contents
FROMTax.dbo.table1
hope it helps./.
|||Yes exactly. When you prefix the DB-name, remember the dbo...
|||Hikaushalparik27
Thanks a lot in your answer.
But I can not copy unicode characters. Why?And how to resolve it?
|||a4nsd:
But I can not copy unicode characters. Why?And how to resolve it?
i am not clear... i mean are you getting any error.. if yes, then which one ?
|||
I mean all data in the table1 are unicode characters,but when I copy to table2, I lost all the format
This is one of my record example.
in table1.title ='M? thêm ?i?m thu l? phí tr??c b?';
when I copy it into table2.(mapping title->Headline) It became table2.Headline = "M? thêm di?m thu l? phí tru?c b?";
How to solve it?Thanks
|||a4nsd:
This is one of my record example.
in table1.title ='M? thêm ?i?m thu l? phí tr??c b?';
when I copy it into table2.(mapping title->Headline) It became table2.Headline = "M? thêm di?m thu l? phí tru?c b?";
just one silly question..
are you sure about the datatype for table2.Headline... (i mean it should be same as table1.title)...
hi
Yes, they are the same type.(nvarchar).how?
|||Hi
I've found out the solution by adding N before each field.
sql
No comments:
Post a Comment