SitePoint Sponsor

User Tag List

Results 1 to 17 of 17

Hybrid View

  1. #1
    Skills to Pay the Bills Sparkie's Avatar
    Join Date
    Jul 1999
    Location
    A cave with 47 computers and an internet feed
    Posts
    3,559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Converting MySQL to SQL Server 2000?

    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

  2. #2
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  4. #4
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    whoops

    now you mention it, I think he does
    PHP-Webservices - Profesional Hosting and Programming of sites.

  5. #5
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by =X=
    I think he does
    Sparkie has girl bits

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  6. #6
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    whoops again
    PHP-Webservices - Profesional Hosting and Programming of sites.

  7. #7
    SitePoint Wizard
    Join Date
    Jul 2001
    Location
    The Netherlands
    Posts
    2,617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Converting MySQL to SQL Server 2000?

    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 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?

  8. #8
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  9. #9
    Skills to Pay the Bills Sparkie's Avatar
    Join Date
    Jul 1999
    Location
    A cave with 47 computers and an internet feed
    Posts
    3,559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All of the data is in MySQL format.

  10. #10
    Database Jedi MattR's Avatar
    Join Date
    Jan 2001
    Location
    buried in the database shell (Washington, DC)
    Posts
    1,107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  11. #11
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Leave it to MS to develop such a stupid way to escape a quote.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  12. #12
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Defender1
    Leave it to MS to develop such a stupid way to escape a quote.
    AFAIK, that's the more standard way to escape quotes.
    - Matt ** Ignore old signature for now... **
    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

  13. #13
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Standard or not it's easier to read a \' in code than ''.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  14. #14
    SitePoint Evangelist
    Join Date
    Oct 2001
    Posts
    592
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Standard?

    AFAIK, that's the more standard way to escape quotes.
    *cough*

    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

  15. #15
    purple monkey dishwasher scoates's Avatar
    Join Date
    Nov 2001
    Location
    Montreal
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  16. #16
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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-D
    never used VB before. be careful saying things like that.



    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 ('').
    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.

  17. #17
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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
    Wayne Luke
    ------------



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •