Solved

Sharing SQL Server objects

Posted on 2014-10-17
3
108 Views
Last Modified: 2014-10-18
I'm by no means a Sql server expert and need some basic help. I have 2 completely separate sql files attached. For example, File 1.mdf and File 2.mdf. I need to modify data in File 1.mdf based on reference tables in File 2.mdf.

Is it even possible to construct a query using both files?

My original thought was to export the files to MS Access to make the changes but File 1.mdf exceeds the 2 Gbyte Access limit so I'm stuck with how to do this in Sql Server directly.

Ideas anyone?
0
Comment
Question by:SpaceCoastLife
3 Comments
 
LVL 17

Accepted Solution

by:
OriNetworks earned 500 total points
ID: 40386589
You can write cross database queries in each database or setup views to access a different database.

In DB1, you can update a table in DB2 like this
Update DB2.dbo.Table1 SET qty=1 WHERE ID=1

In DB2, you can do the same things to update a table in DB1 like this
Update DB1.dbo.tbl SET thiscolumn=1 WHERE ID=1
0
 
LVL 33

Expert Comment

by:ste5an
ID: 40386603
D'oh? .mdf files are the database file. As long as you don't want to reinvent the wheel and code your own SQL server

So, can you please rephrase your question and tell us what you're trying to do actually?
0
 

Author Closing Comment

by:SpaceCoastLife
ID: 40388974
Found an easier way to accomplish this but thanks for the input anyway.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question