updating table of one database with data from another database?
-
hi, i have two databases which are used for different projects. but i need to update a column of one database with the data from another database. is there a way to do that using SPs? or any other way? thanks. regards.
-
hi, i have two databases which are used for different projects. but i need to update a column of one database with the data from another database. is there a way to do that using SPs? or any other way? thanks. regards.
You can do this job by these statement. 1)Declare a Variable like v 2)Select the record you want use by SELECT Statement and assign it to the v by = operator 3)Update the record you want by UPDATE Statement and set it to the v. I hope this solution is useful
-
hi, i have two databases which are used for different projects. but i need to update a column of one database with the data from another database. is there a way to do that using SPs? or any other way? thanks. regards.
Here we go!! Use joins (normal, left or right) between tables across the databases. You can call different databases in TSQL with dot operators (..). Eg:- Select n.name from northwind..authors n, pubs..aurhors p where p.authorid = n.authorid
Thanks, Ziyad Mohammad[http://www.dotnetsoldier.blogspot.com/]
-
hi, i have two databases which are used for different projects. but i need to update a column of one database with the data from another database. is there a way to do that using SPs? or any other way? thanks. regards.
You need to prefix the schema.tablename with the name of the database. For instance:
Update database1.myschema.table1 set value = 10 where id = 20
Deja View - the feeling that you've seen this post before.