|
-
Jul 3rd, 2008, 09:47 AM
#1
Thread Starter
Fanatic Member
Using multiple databases
We are using MS sequel server and have a production data base provided by a third party. We need to create additional views, stored procedures and even some customized tables.
My question is: Could we put those in a "customized" data base and still be able to access tables in the prodiction data base? If so, how would a sp or view located in the "customized" db know to look for tables in the "production" db. In my vb program do I need to connect to both data bases and call the sp in the customized data base and it will find the table(s) in the production data base? Also If I have a table in both customized and production data base that need to be part of same sp will that be a problem?
-
Jul 3rd, 2008, 11:20 AM
#2
Re: Using multiple databases
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 3rd, 2008, 11:27 AM
#3
Re: Using multiple databases
Are the custumized db and the orginal on the same database server? If you you can use use the fully qualified path for the object
dbname.shcemaname.objectname
If on different servers setup a linked db and then do the same
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Jul 3rd, 2008, 12:42 PM
#4
Thread Starter
Fanatic Member
Re: Using multiple databases
Yes, they are located on the same db server. If I understand you correctly I should be able to use tableA from data base A and and tableB from data base B as long as I use a fully qualified path in my stored procedure, correct? Would I then in my vb program have to open 2 connections like:
Dim ConnectionString1 = "Data Source=VGIWPW03-SQL3;Initial Catalog=Prod;User Id=xx;Password=yy;"
and
Dim ConnectionString2 = "Data Source=VGIWPW03-SQL3;Initial Catalog=Custom;User Id=xx;Password=yy;"
Last edited by snufse; Jul 3rd, 2008 at 12:58 PM.
-
Jul 3rd, 2008, 01:24 PM
#5
Re: Using multiple databases
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Jul 4th, 2008, 02:54 AM
#6
Re: Using multiple databases
You will only need two connection strings if your planning to run stored procedures from both databases.
Otherwise just use the one connection, as your stored procedure will be doing the join across the databases.
Make sure the username you use has access rights to both databases.
-
Jul 4th, 2008, 05:07 AM
#7
Re: Using multiple databases
Just as an additional note, now this thread has already been answered! The complete, expanded syntax is SQLServerInstanceName.CatalogName.OwnerName.Tablename.
If this were to be expanded to a database upon a second SQL Server instance;upon a different server, you must first link in the secondary SQL server into initial SQL Server instance which will be performing the accessing. This can be done via the management studio UI or by calling the sp_addlinkedserver system stored procedure.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|