2

Possible Duplicate:
LINQ: Join MySql and SQL Server tables

I don't think it's possible but is there any way you can do a join on a table in a MYSQL database to a table in SQL server?

I rather expect I'll need to make an array of data from MYSQL and programmatically use it against the data in the SQL Server but thought I'd check first!

Community
  • 1
  • 1
Simon R
  • 3,732
  • 4
  • 31
  • 39
  • 1
    from SQL Server create a linked server to the MySQL server. now you can just do a join, your join will look like `FROM dbo.Table1 t1 LEFT JOIN LinkedMySQL.DbName.SChem>TableName t2 on t1.SomeColumn = t2.SomeColumn` notice the 4 part notation against the linked server, use `sp_addlinkedserver` to create the linked server – SQLMenace Nov 20 '12 at 11:55
  • See http://stackoverflow.com/questions/6256790/linq-join-mysql-and-sql-server-tables – powtac Nov 20 '12 at 11:55
  • And http://www.unityjdbc.com/doc/multiple/multiplequery.php – powtac Nov 20 '12 at 11:56

1 Answers1

0

One option is to link your MySql database through MS SQL Server. Then access both databases through your SQL Server DataContext. Here's a couple examples of how to set up the link and docs:

http://www.ideaexcursion.com/2009/02/25/howto-setup-sql-server-linked-server-to-mysql/

http://sql-articles.com/blogs/creating-linked-server-to-mysql-from-sql-server/

MSDN: Linking Servers With that complete, you may want to expose the linked tables with either stored procedures or views so they appear to be part of the SQL Server database.

Keep in mind that this approach (and any approach I can think of) won't be particularly fast. There's no magic to speed up the cost of relating data across databases and a network. It's biggest benefit is that it presents a consistent and simple view of the data to the application developer.

Taken from

LINQ: Join MySql and SQL Server tables

Community
  • 1
  • 1
Thangamani Palanisamy
  • 5,152
  • 4
  • 32
  • 39