Showing posts with label db1. Show all posts
Showing posts with label db1. Show all posts

Friday, March 23, 2012

Reflecting changes in production Db onto staging DB

I have a database db1 on server1 and server2.The Db On server1 is a production db and the Db on server2 is a staging Db.All the new data will be coming into production Db.And i wanted to update the data and database structures on staging Db from production Db on weekly basis.So how can I reflect the data and datastructures on my staging Db from my production Db.

Thanks.I'd recommend backup and restore. I've never found anything else that completely satisfies me.

-PatP

Friday, March 9, 2012

Reference 2 Databases in SQL Statement

I need to join a table with another table in a different database. Is this possible?

Assume Table1 is in DB1 and Table2 is in DB2.

Thanks!

Brian

Simple, just prefrace the table name with the database name.

e.g. SELECT * FROM database1..table1 JOIN database2..table2 ON ...

|||

Brian:

It should simply be something like:

Code Snippet

select <columnList>

from Db1.schema1.Table1

join Db2.schema2.Table2

...

|||

search for "linked servers"

Reference 2 Databases in SQL Statement

I need to join a table with another table in a different database. Is this possible?

Assume Table1 is in DB1 and Table2 is in DB2.

Thanks!

Brian

Simple, just prefrace the table name with the database name.

e.g. SELECT * FROM database1..table1 JOIN database2..table2 ON ...

|||

Brian:

It should simply be something like:

Code Snippet

select <columnList>

from Db1.schema1.Table1

join Db2.schema2.Table2

...

|||

search for "linked servers"