Is it possible? I'm hosted with a site that uses SQL Server 2000, but my scripts are all MySQL documents. Is there some way to set them up so they'll work in SQL Server 2000?
Help!!
Sparkie
| SitePoint Sponsor |





Is it possible? I'm hosted with a site that uses SQL Server 2000, but my scripts are all MySQL documents. Is there some way to set them up so they'll work in SQL Server 2000?
Help!!
Sparkie
most of the functions are identical exept for the prefix
mysql_fetch_array => mssql_fetch_array
so normally just changing those SHOULD work
ofcourse you better check on
http://php.easynet.be/manual/en/ref.mssql.php and
http://php.easynet.be/manual/en/ref.mysql.php
to see if all the functions you have used can be converted...they don't share all the same functions, although the most used are the same
maybe some tweaking and changing is needed but most part will work by just doing a replace on mysql_ to mssql_
PHP-Webservices - Profesional Hosting and Programming of sites.
Do you mean converting the data Sparks?
Sean![]()
Harry Potter
-- You lived inside my world so softly
-- Protected only by the kindness of your nature
whoops
now you mention it, I think he does![]()
PHP-Webservices - Profesional Hosting and Programming of sites.
Sparkie has girl bitsOriginally posted by =X¥®µ§=
I think he does![]()
Sean![]()
Harry Potter
-- You lived inside my world so softly
-- Protected only by the kindness of your nature
whoops again![]()
![]()
PHP-Webservices - Profesional Hosting and Programming of sites.





I assume this means the scripts she uses to access the data? So =X¥®µ§= was on the right track, or am I taking this the wrong way?Originally posted by Sparkie
Is it possible? I'm hosted with a site that uses SQL Server 2000, but my scripts are all MySQL documents. Is there some way to set them up so they'll work in SQL Server 2000?
Help!!
Sparkie
I don't know Mark, that's why I asked
Sean![]()
Harry Potter
-- You lived inside my world so softly
-- Protected only by the kindness of your nature





All of the data is in MySQL format.





MS SQL uses a different quote escape character.
Instead of:
'Don\' forget the backslash!'
MS SQL does:
'Don''t forget the double single quote!'
So if you do a dump of the data in CSV format or the like you should run some sort of search and replace to change \' to ''.
Then you can either use BCP or MS DTS to load the CSV file right into one of your tables.
Matt - Sybase DBA / PHP fanatic
Sybase/MySQL/Oracle | I don't like MySQL
Download Sybase | DBForums.com - for all your RDBMS talk





Leave it to MS to develop such a stupid way to escape a quote.
AFAIK, that's the more standard way to escape quotes.Originally posted by Defender1
Leave it to MS to develop such a stupid way to escape a quote.
- Matt
Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
"Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR





Standard or not it's easier to read a \' in code than ''.



*cough*AFAIK, that's the more standard way to escape quotes.
In the Microsoft Windows Visual Basic world it is, yes. But in the real world, they use backslashes.
:-)
Be careful saying things like 'this is the more standard way', because it tells us about where you're coming from, and it ain't always good... (To name VB, for example) 8-D
Vincent




I'm sure that '' is the ANSI SQL Specific way to escape a quote. Some DBs allow \' (which, IMHO is better, and much more readable), but the standard, is, in fact, two quote characters together ('').
I think there's a switch to make MySQL behave "properly", even.
S
never used VB before.Originally posted by voostind
Be careful saying things like 'this is the more standard way', because it tells us about where you're coming from, and it ain't always good... (To name VB, for example) 8-Dbe careful saying things like that.
yep, that's what i thought. i think every DB supports '' since it's the SQL standard. for example, in the Postgre manual it says Postgre "also supports escaping with a backslash (\\')," which implies that '' is the standard way of doing it.Originally posted by scoates
I'm sure that '' is the ANSI SQL Specific way to escape a quote. Some DBs allow \' (which, IMHO is better, and much more readable), but the standard, is, in fact, two quote characters together ('').![]()
Converting your data from MySQL to SQL Server 2000 will be two-fold...
First you will need to get the data out of MySQL. The easiest way to do this is to use something like PHPMyAdmin and save the data as CSV files.
After that you will have to massage the data so that you won't have errors in the import.
The second step requires you to build your tables in SQL Server. You can use the basic table definations for your MySQL scripts as a start but there is no such thing as AUTO-INCREMENT fields (instead you have identity fields) and indices are defined differently. You will have to make these modifications.
Finally you will use SQL Server's tools to load the CSV files into the proper tables.
For detailed information on porting your scripts you can look at this guide provided by Microsoft:
http://www.microsoft.com/technet/tre...vg/win2kcd.asp
Bookmarks