2 replies
by sally w Accepted solution
by tony hopkinson Accepted solution
pull data from a different database on the same server.
Select * From DatabaseName..TableName
The user you are connected as needs to authorised in both DBs. Generally you are better off connecting with your windows login than using sql server ones other than sa.
To 'merge' the columns of two tables you do something like this
Select Column1, Column2 From Table1
UNION
Select Col1,Col2 From Table2
Column1 and Column2 will be the fieldnames in the result.
If that gets messay then you can do something like this
Select Column1 As MyNewColumn1, Column2 as MyNewColumn2 From Table1
UNION
Select Col1,Col2 From Table2
HtHs
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending