Click here to Skip to main content
15,908,264 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have two databases on an online website hosting. but some how i need to copy some of the records from on database to another, for more processing etc. on my local pc i could simplye query it as

SQL
insert into database2.schema.table
select * from database1.schema.table,


but on online server that is not possible because of security issues. i googled and found these commands

SQL
exec sp_addlinkedserver @Server='myserver',
    @srvproduct    = '', @provider  = 'SQLNCLI', @catalog       = 'catalogname' ;
    EXEC sp_addlinkedsrvlogin @rmtsrvname='myserver',
        @useself='false',
        @rmtuser='username',
        @rmtpassword='password';


but i dont have enough permissions to execute it online, so is there any other way to access a database from another database?

PS: the second database is like an IMAGE DATA TABLE for temporary records management, first it copies records from first database after changes and work out etc, it will be writing it back to first database, My goal is to write SQL procedures which can select/write records from/to first database to second database.
Posted
Updated 17-Aug-13 8:25am
v2
Comments
RedDk 17-Aug-13 20:55pm    
"I have two databases on an online website hosting. But (somehow) I need to copy some of the records from one database to the other, for more processing, etc. On my local pc, I can simply query ... (by doing the next ...)"

Let me ask this: do you have SQL Server (any version) installed on you're "local pc"?
psychic6000 20-Aug-13 9:33am    
that exactly i meant by the that line, that i have sql on my pc and trails on this are working fine.... and sql version is already defined in question tag... 2008... :)

1 solution

i can get you another solution :

1)Backup your online database and restore it locally.
2)Copy the required records inside the new database locally.
3)Backup the new locally database and restore it online.
 
Share this answer
 
Comments
psychic6000 17-Aug-13 14:20pm    
thanks for suggestion but, its not one time job, if it was, i could have written a web page to read data from one data table and write it in another, i want it at SQL level without involvement of any human... specifically me! and to be executed randomly...

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