Click here to Skip to main content
15,898,036 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,

Iam c# and Sql server 2005

i have to insert data from one database into another database.

one database is local and other is dyndns

ex:example.dyndns.org\server is my another database name

how can i insert into another database selecting the table from the local


insert into [example.dyndns.org\SERVER].[MainShopWork].[dbo.Inv_Brand]
select * from temp

but this is giving error


Regards
Nirmala devi
Posted
Comments
[no name] 22-Jun-14 8:07am    
http://www.google.com/search?q=How+to+insert+into+table+from+one+database+to+another+database

Further to solution 1 ... your code
SQL
insert into [example.dyndns.org\SERVER].[MainShopWork].[dbo.Inv_Brand]
 select * from temp
implies that you have a table called "dbo.Inv_Brand".

I suspect you actually have a table Inv_Brand for the schema/table owner dbo so your code should have read
SQL
insert into [example.dyndns.org\SERVER].[MainShopWork].[dbo].[Inv_Brand]
 select * from temp


By the way "is giving error" should have been followed by the wording of the error - we can't see your screen or see through your eyes to find out what the problem is.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900