Showing posts with label searched. Show all posts
Showing posts with label searched. Show all posts

Monday, March 26, 2012

How do I join tables from different databases (under same server though)

Hey, I have two databases (db1 and db2) under the same server. How do I combine tables from both of them?

I searched the forum and tried

SELECT

t1.col1

,t2.col2

FROM

db1.dbo.table1 t1

INNER JOIN

db2.dbo.table2 t2

ON t1.somecol = t2.somecol

I get Error Message: Invalid object name 'db1.dbo.table1
Error source: .Net SqlClient Data Provider

I read somewhere that the connectionstring could cause the problem since I'm trying to access two databases. I'm using SQL Server Express

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\db1.mdf;Integrated Security=True;User Instance=True"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT t1.col1, t2.col2 FROM db1.dbo.table1 t1 INNER JOIN db2.dbo.table2 t2 ON t1.somecol = t2.somecol"></asp:SqlDataSource>


Anyway, how can I solve this?ahhh comon, someone must know a solution|||

I guess that may because the 2 databases can not 'recognize' each other. Have you ever tried register the 2 databases into SQL Express by Detach/Attach? You can firstly detach the databases from your project, and then attach them in Management Studio:

http://msdn2.microsoft.com/en-us/library/ms190209.aspx

|||thanks for the idea, i'll look into it and see what I can find out.sql

Sunday, February 19, 2012

How do I display/upgrade SQL license Info

In SQL 2000 you went to Control Panel and SQL Licensing to view licensing mode and qty. I have searched everywhere for the equivelant in 2005 including books online, knowledge base but can't find anything.

Anybody know where it is hidden as I need to check this server is set up for per processor and check how many processors?

Thanks

Richard

This does not exist in SQL Server 2005, it works by the honour system