Solved

MYSQL migration to MS sql 2005 using PHP

Posted on 2006-10-19
7
205 Views
Last Modified: 2013-12-12
hi
im currenly using Mysql as my database manager, however i'd now like to use MSSQL 2005,
my question is, what steps do i need to take to make the change (in terms of updating the PHP code)

are there any differences in the query and connection strings?

are the full text search strings also the same ?

eg.
$sql = " 

            SELECT *,
            MATCH (item,description) AGAINST ('$query') AS score
                FROM items
            WHERE MATCH (item,description) AGAINST ('$query')
            ORDER BY score DESC

        ";
does any of this need to be changed?

thanks
0
Comment
Question by:intazaar
  • 4
  • 3
7 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17771746
if you use mysql_xxxx functions, you will have to replace them all by the corresponding mssql_xxxx functions, and note that not all functions have the same name or behave exactly the same way.

>are the full text search strings also the same ?
not at all:
http://msdn2.microsoft.com/en-us/library/ms142559.aspx
0
 

Author Comment

by:intazaar
ID: 17771763
can you tell me which functions that 'dont behave the same way'?


and what would the code below be if it were converted to sql 2005

$sql = " 

            SELECT *,
          MATCH (item,description) AGAINST ('$query') AS score
                FROM items
            WHERE MATCH (item,description) AGAINST ('$query')
            ORDER BY score DESC

        ";
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17771806
I see you posted already a new question, please delete it, I will follow-up here, please be patient... just getting the infos to post...
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17771825
you need either FREETEXT:
http://msdn2.microsoft.com/en-us/library/ms176078.aspx

or the CONTAINSTABLE:
http://msdn2.microsoft.com/en-us/library/ms189760.aspx

the links contain samples... if you really want to (have to) migrate, take the time to learn them...



in regards to functions that don't have the same name and/or behaviour:
mysql_error()  -> mssql_ get_ last_ message()  , but that function gives also warnings...
all mssql_xxx functions of php:
http://php.net/function.mssql-query

0
 

Author Comment

by:intazaar
ID: 17771849
ok... then...

the current code below is for MYSQL-PHP what would be the code to give me the saem result for MSSQL. NOTE: the 'score' syntax

$sql = " 

            SELECT *,
          MATCH (item,description) AGAINST ('$query') AS score
                FROM items
            WHERE MATCH (item,description) AGAINST ('$query')
            ORDER BY score DESC

        ";

0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 17771865
it would look like this:
$sql = "
SELECT i.* , r.RANK as score
    FROM Items i
    INNER JOIN CONTAINSTABLE(items, item,Description,
        'ISABOUT  $query ' ) AS r
            ON i.itemid = r.[KEY]
ORDER BY r.RANK DESC
";
0
 

Author Comment

by:intazaar
ID: 17771909
thank you
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now