views:

49

answers:

3

Hi,
We have an application which uses WAMP server. Now, there is a new requirement from a customer who wants to use MS SQL Server instead of MySQL. How easy is it to port to SQL Server from MySQL. Also it has to retain this configuration. Apache->PHP->SQL Server on windows. How can I connect from Apache to SQL Server. Hope PHP works well with SQL server.

Please advise.
Thanks,
Vish

A: 

I'm guessing you mean MSSQL?

http://us2.php.net/mssql

mySQL... msSQL ... basically the same. You shouldn't have any problems if you don't use "fancy" queries - best would be just to try it out and see what happens.

Tobias
Yes, Microsoft SQL Server. Need to know the setup between Apache and MS SQL Server.
Vish
+2  A: 

You don't need to do anything special with Apache, you just need to use the correct interface in PHP. That is, the mssql stuff that Tobias linked to, or - perhaps better - PDO which can be configured to use either MySQL or MS SQL. PDO would probably be a lot easier going forward if you have to end up supporting both database engines.

In terms of differences between the MySQL and SQL Server, there are quite a lot unfortunately. Most annoying will be that the syntax for certain types of queries will be slightly different (and DDL - that is, creating tables, indexes and so on - is completely different!) Though they both support a big enough subset of standard SQL that you can usually find a way to do most everything that works in both of them. But don't expect to just connect to SQL Server and have all of your queries written for MySQL "just work" - unfortunately, they won't.

I guess in the end, the easiest thing to do is just to try it out. If it looks like it's going to be too much (for example, if you're using a lot of 'obscure' MySQL features), then you might have to rethink your options.

Dean Harding
Thanks Tobias and Codeka, yes will try it out first and lets see how it goes.
Vish
I'd rather use the sqlsvr extension than the dblib based mssql on a Wamp server. It also provides a PDO driver. see http://msdn.microsoft.com/en-us/library/ee229551%28v=SQL.10%29.aspx
VolkerK
Hi Volker, So can I just add this sqlsvr extension to my existing WAMP server and then tune PHP to talk to MS SQL?
Vish
A: 

There are huge differences between MYSQL and MS even in basic queries.
So, all your database work should be rewritten.
The rest is not a big deal.

Col. Shrapnel