There are two server
1)192.168.*.*
2)192.162.*.*

In first server there is database call department which contain table called employee
Now i want to copy the from above to second server in database company which contain table employee

Just use SSIS. It is easiest.

Alternative: use a linked server. You can look in BOL and read about sp_createlinkedserver. You can use this to dynamically create/destroy your link so you minimize your security window.

Thank for your reply
But i want to write the select with insert for the same.
I googled it but i am not getting.

Understood, and I'm sorry my answer didn't help.

However, in order to copy data between one server (or instance) and another, you will have to use one of these techniques. SQL Server does not allow you to write a single select to move data from one server to another without establishing a connection via linked server or using SSIS or some other integration tool. Please do look at the transact-sql help file (a.k.a. "BOL") and see how linked servers work. Once that link is established, you can use the form

insert into dbo.mytable
select * from [LinkedServer].[Database].[Schema].[Table]

where each node corresponds to linked server name, database name, schema name (usually dbo) and table name. You can even join the tables across these links, although performance may not be great.

where can i find transact-sql help file (a.k.a. "BOL")

Should be in your client tools "Help" menu when you create a query. Alternatively you can go to the Microsoft web site and search for it there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.