SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: PHP and MSSQL

  1. #1
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP and MSSQL

    Hi,

    For my mailing list script (MyMail) some user asked me if it was possible to use mssql instead of Mysql. The problem is that I've never used ms sql and was wondering that syntax differences they have.

    From the resources(limited) that i've found, it looks to be the same, but is there anything much difference except having to use: mssql_x instead of mysql_x.

    The queries that I have aren't very complex and are plain insert into.. select from...update table...no links of any sort.

    Thanks
    -Peter

  2. #2
    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)
    The only problem will be the 'LIMIT' extension in MySQL. It does not exist in T-SQL (which is what MS SQL and Sybase use) so you will have to find a workaround if you find any limit commands.

    Also, MySQL allows this for some unknown reason:
    Code:
    SELECT *
      FROM table
     WHERE some_integer_column = '4333'
    Obviously that turns '4333' into a character string and you will get an error. MySQL conveniently ignores that and EVERYONE writes that way (for some God-forsaken reason!).

    Another minor thing is if you are using an auto_increment column you would insert like this (bob( somecol AUTO_INCREMENT, somethingelse CHAR( 5 )):
    Code:
    INSERT INTO bob
        VALUES( NULL,
                'happy' );
    In T-SQL you leave off the NULL (bob( somecol IDENTITY, somethingelse CHAR( 5 ))):
    Code:
    INSERT INTO bob
        VALUES( 'happy' )
    GO


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
  •