need mysql to mssql conversion

CREATE TABLE music_downloads (
  ID int(11) NOT NULL auto_increment,
  Artist varchar(255) default NULL,
  TrackTitle varchar(255) default NULL,
  Genre varchar(255) default NULL,
  URL varchar(255) default NULL,
  Downloads int(11) default '0',
  PRIMARY KEY  (ID)
) TYPE=MyISAM;


Thanks!
toddynhoAsked:
Who is Participating?
 
rafranciscoConnect With a Mentor Commented:
Add this line before the first INSERT

SET IDENTITY_INSERT music_downloads ON

Then add this line after the last INSERT

SET IDENTITY_INSERT music_downloads OFF
0
 
rafranciscoCommented:
Try this:

CREATE TABLE music_downloads (
  ID int NOT NULL IDENTITY PRIMARY KEY,
  Artist varchar(255) default NULL,
  TrackTitle varchar(255) default NULL,
  Genre varchar(255) default NULL,
  URL varchar(255) default NULL,
  Downloads int default '0'
)
0
 
toddynhoAuthor Commented:
Thanks for your help with the first question, I've upped the point value some if you can help me troubleshoot this problem I'm having now... Any idea why I'm getting the following error now...


Warning: mssql_query(): message: Line 31: Incorrect syntax near 's'. (severity 15) in /var/www/site/music_db.php on line 65

Warning: mssql_query(): message: Line 37: Incorrect syntax near 're'. (severity 15) in /var/www/site/music_db.php on line 65

Warning: mssql_query(): Query failed in /var/www/site/music_db.php on line 65


<?php
     $myServer = "dddd";
     $myUser = "dddd";
     $myPass = "dddd";
     $myDB = "dddd";

$sqlconn = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");

$d = mssql_select_db($myDB, $sqlconn)
or die("Couldn't open database $myDB");
        
$result = mssql_query ("
INSERT INTO music_downloads VALUES (2, 'All That Matters', '30 Second Song', 'Rock', 'www.37Records.com', 0);
INSERT INTO music_downloads VALUES (3, 'All That Matters', 'Superhero Guy', 'Rock', 'www.37Records.com', 11);
INSERT INTO music_downloads VALUES (4, 'All That Matters', 'Baby Girl', 'Rock', 'www.37Records.com', 4);
INSERT INTO music_downloads VALUES (5, 'Bitstream Dream', 'Falling Remix', 'Electronica', 'www.bitstream.com', 23);
INSERT INTO music_downloads VALUES (6, 'Bitstream Dream', 'Futurist', 'Electronica', 'www.bitstream.com', 4);
INSERT INTO music_downloads VALUES (7, 'Bitstream Dream', 'Meltdown', 'Electronica', 'www.bitstream.com', 11);
INSERT INTO music_downloads VALUES (8, 'Bitstream Dream', 'Oscillate', 'Electronica', 'www.bitstream.com', 5);
INSERT INTO music_downloads VALUES (9, 'Bitstream Dream', 'Oscillate', 'Electronica', 'www.bitstream.com', 14);
INSERT INTO music_downloads VALUES (10, 'Bitstream Dream', 'We Represent Hypersonic', 'Electronica', 'www.bitstream.com', 3);
INSERT INTO music_downloads VALUES (11, 'Bitstream Dream', 'Whirlwind', 'Electronica', 'www.bitstream.com', 6);
INSERT INTO music_downloads VALUES (12, 'Bitstream Dream', 'Windmills Remix', 'Electronica', 'www.bitstream.com', 17);
INSERT INTO music_downloads VALUES (13, 'Blesk', 'These Days', 'Alternative Rock', 'www.blesk.tk', 21);
INSERT INTO music_downloads VALUES (14, 'Blesk', 'Welcome To The Inside', 'Alternative Rock', 'www.blesk.tk', 11);
INSERT INTO music_downloads VALUES (15, 'Blesk', 'Like A Fire', 'Alternative Rock', 'www.blesk.tk', 4);
INSERT INTO music_downloads VALUES (16, 'Blesk', 'Sleep', 'Alternative Rock', 'www.blesk.tk', 12);
INSERT INTO music_downloads VALUES (17, 'Cathy-Anne McClintock', 'I Wanna Like Like That', 'Rock', 'www.37Records.com', 3);
INSERT INTO music_downloads VALUES (18, 'Cathy-Anne McClintock', 'Who Knew', 'Rock', 'www.37Records.com', 8);
INSERT INTO music_downloads VALUES (19, 'Cathy-Anne McClintock', 'When Passion Calls', 'Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (20, 'Chad Petree', 'Emily', 'Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (21, 'Chad Petree', 'If Love is Blind', 'Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (22, 'Chad Petree', 'Money for That', 'Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (23, 'Daniel Sadowski', 'Cloud9', 'Hip Hop', 'epicvibe.tripod.com', 9);
INSERT INTO music_downloads VALUES (24, 'Daniel Sadowski', 'DuhDuhDuh', 'Hip Hop', 'epicvibe.tripod.com', 1);
INSERT INTO music_downloads VALUES (25, 'Daniel Sadowski', 'Ilikeit', 'Hip Hop', 'epicvibe.tripod.com', 1);
INSERT INTO music_downloads VALUES (26, 'Daniel Sadowski', 'Slanted View', 'Hip Hop', 'epicvibe.tripod.com', 1);
INSERT INTO music_downloads VALUES (27, 'Daniel Sadowski', 'You Think', 'Hip Hop', 'epicvibe.tripod.com', 1);
INSERT INTO music_downloads VALUES (28, 'Dexter', 'Burn This', 'Pop/Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (29, 'Dexter', 'Someone Somewhere', 'Pop/Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (30, 'Dexter', 'With A Passion', 'Pop/Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (31, 'Kimberlye Gold', 'What\'s In A Name', 'Pop/Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (32, 'Kimberlye Gold', 'You Piss Me Off', 'Pop/Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (33, 'Kimberlye Gold', 'Nothing I Don\'t Already Know', 'Pop/Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (34, 'Less Than Perfect', 'Forever Holding On', 'Alternative Rock', 'www.ltprock.net', 1);
INSERT INTO music_downloads VALUES (35, 'Moxy', 'Sunny Days', 'Alternative Rock', 'www.moxymusic.com', 1);
INSERT INTO music_downloads VALUES (36, 'Moxy', 'Sexy Dream', 'Alternative Rock', 'www.moxymusic.com', 1);
INSERT INTO music_downloads VALUES (37, 'Moxy', 'You\'re Gonna Miss Me', 'Alternative Rock', 'www.moxymusic.com', 1);
INSERT INTO music_downloads VALUES (38, 'Moxy', 'Sugar', 'Alternative Rock', 'www.moxymusic.com', 1);
INSERT INTO music_downloads VALUES (39, 'Moxy', 'Pure', 'Alternative Rock', 'www.moxymusic.com', 1);
INSERT INTO music_downloads VALUES (40, 'Moxy', 'Still', 'Alternative Rock', 'www.moxymusic.com', 1);
INSERT INTO music_downloads VALUES (41, 'Paradigm', 'Sure', 'Pop/Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (42, 'Paradigm', 'Tea', 'Pop/Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (43, 'Paradigm', 'Understanding (Green)', 'Pop/Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (44, 'Private i', 'Talk To Me', 'Pop/New Wave', 'www.37Records.com', 21);
INSERT INTO music_downloads VALUES (45, 'Private i', 'Here In This Life', 'Pop/New Wave', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (46, 'Private i', 'Turn On the Night', 'Pop/New Wave', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (47, 'Shiny Toy Guns', 'Don\'t Cry Out', 'Pop/Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (48, 'Shiny Toy Guns', 'Photograph', 'Pop/Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (49, 'Shiny Toy Guns', 'The Weather Girl', 'Pop/Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (50, 'Steven McClintock', 'Knock Knock', 'Pop/Rock', 'www.37Records.com', 1);
INSERT INTO music_downloads VALUES (51, 'Steven McClintock', 'My Turn To Cry', 'Pop/Rock', 'www.37Records.com', 11);
INSERT INTO music_downloads VALUES (52, 'Steven McClintock', 'Testify', 'Pop/Rock', 'www.37Records.com', 7);
");
?>
0
 
rafranciscoCommented:
Look at the row with ID = 31, where the track title is "What\'s In A Name".  Instead of using \' to escape a single-quote character, put two single-quotes (not a double-quote).  So that track title will become "What''s In A Name".

0
 
toddynhoAuthor Commented:
now, I'm getting this error...

Warning: mssql_query(): message: An explicit value for the identity column in table 'music_downloads' can only be specified when a column list is used and IDENTITY_INSERT is ON. (severity 16) in /var/www/site/music_db.php on line 65
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.