Converting a old .sql to new

  • Hey all, I have a question from a complete noob to sql. I have a old set up .sql that was written around 2004. I'm trying to use it in server 2008, but it gets a lot of errors. I've been told it's due to language changes since it was written. Here's the contents.

    # Create the database 'web'

    # and switch the connection to 'web'

    CREATE DATABASE web;

    USE web;

    # Database: web

    # Table: 'nwn_sessions'

    #

    CREATE TABLE `nwn_sessions` (

    `session_id` varchar(32) NOT NULL default '',

    `session_created` int(11) NOT NULL default '0',

    `session_active` int(11) NOT NULL default '0',

    `session_counter` int(11) NOT NULL default '0',

    `session_remote_address` varchar(128) NOT NULL default '',

    `session_data` longtext NOT NULL

    ) TYPE=MyISAM;

    GRANT ALL PRIVILEGES ON web.*

    TO 'session_user'@'localhost'

    IDENTIFIED BY 'session_pass';

    Does that appear to be the case? If so what's involved in changing it over?

    Thank you for any help!!

  • Not sure, but this looks like it may be for MySQL not MS SQL Server. I don't have the time to look harder at the moment as I am getting ready to leave for work.

  • As Lynn said this appears to be MySql. You will have to confirm what datatypes you actually want but this should be close.

    CREATE TABLE nwn_sessions

    (

    session_id varchar(32) NOT NULL default '',

    session_created int NOT NULL default 0,

    session_active int NOT NULL default 0,

    session_counter int NOT NULL default 0,

    session_remote_address varchar(128) NOT NULL default '',

    session_data varchar(max) NOT NULL

    )

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Lynn Pettis (5/28/2013)


    Not sure, but this looks like it may be for MySQL not MS SQL Server. I don't have the time to look harder at the moment as I am getting ready to leave for work.

    Yes, this does not looks like a code of MS Sql Server..

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • It isn't SQL Server code that I've ever seen before. It isn't Oracle either. I don't know MySQL, so I won't comment on that.

    Perhaps the best way to convert it is to look at what it would create in whatever DBMS it's written in and then update your data types to the appropriate SQL Server data type as you type it.

    Unfortunately, SQL isn't always portable from one database platform to another; there are always differences.

  • Thanks everyone for the responses. I contacted the person I got it from, and it's indeed MySQL. Thanks again!!

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply