Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 Running a .sql file
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

redbrad0
Advanced Member

USA
3725 Posts

Posted - 05 December 2003 :  00:58:46  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
I have a SQL file which has text like below. I am trying to figure out how to run it and tried thru Query Anaylzer. When I try to run it, it says "[Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error" anyone have any ideas?


# --------------------------------------------------------

#
# Table structure for table `FORUM_ACTIVE_USERS`
#

CREATE TABLE `FORUM_ACTIVE_USERS` (
  `MEMBER_ID` int(11) default NULL,
  `AU_IP` varchar(40) default NULL,
  `AU_LOGINTIME` varchar(100) default NULL,
  `AU_LASTACTIVETIME` varchar(100) default NULL,
  `AU_LASTPAGE` varchar(250) default NULL,
  `AU_QUERYSTRING` text,
  `AU_USER_AGENT` text
) TYPE=MyISAM;

#
# Dumping data for table `FORUM_ACTIVE_USERS`
#

# --------------------------------------------------------

#
# Table structure for table `FORUM_ADS_CATEGORY`
#

#####CREATE TABLE `FORUM_ADS_CATEGORY` (
#####  `ID` int(11) NOT NULL auto_increment,
#####  `CATEGORY_NAME` varchar(50) NOT NULL default '',
#####  `DESCRIPTION` text,
#####  PRIMARY KEY  (`ID`)
#####) TYPE=MyISAM AUTO_INCREMENT=11 ;

#
# Dumping data for table `FORUM_ADS_CATEGORY`
#

INSERT INTO `FORUM_ADS_CATEGORY` VALUES (7, 'Jeep in vendita', '');
INSERT INTO `FORUM_ADS_CATEGORY` VALUES (8, 'Parti usate', 'qualsiasi componente usato vi avanzi');
INSERT INTO `FORUM_ADS_CATEGORY` VALUES (9, 'Richieste parti/pezzi/jeep', 'qui le vostre richieste');
INSERT INTO `FORUM_ADS_CATEGORY` VALUES (10, 'extra Jeep - varie', 'tutto quello che non č jeep..');

# --------------------------------------------------------


Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 05 December 2003 :  01:49:00  Show Profile  Visit Gremlin's Homepage
Don't you want to be running that against a mySQL Database rather than a SQL Server ? its a mySQL dump file.

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 05 December 2003 :  08:51:16  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
Well I exported the sql file from mysql but i need to import the data into ms sql server

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 05 December 2003 :  12:00:16  Show Profile  Visit dayve's Homepage
quote:
Originally posted by redbrad0

Well I exported the sql file from mysql but i need to import the data into ms sql server


Just use the SQL wizard to import, provided you have your DSN/ODBC set up for the database in mySQL. Real simple.

Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 05 December 2003 :  15:08:13  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
Well I have tried to connect to the mySql database and the guy told me that I can not connect to it from outside their network which i thought was odd, they just have the web based admin section for it where i could export that script.

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 05 December 2003 :  15:20:53  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
Someone suggested that I should install mySql and then import this file into mysql and then transfer it in MS Sql. This just seems like so much work and I would think their would be a much easier way.

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 05 December 2003 :  16:43:59  Show Profile  Visit dayve's Homepage
all you need is the ODBC and then create a DSN and use the import wizard in SQL Server.

Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 06 December 2003 :  09:29:06  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
I can not even ping the IP Address of the mySql database because every request is timed out. I have mySql Control Center (http://www.mysql.com/products/mysqlcc/index.html) and I can not connect to it thru that either. So all I can really go with is one of these .sql files.

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 06 December 2003 :  20:44:22  Show Profile  Visit Gremlin's Homepage
Or install your own mysql server quickly to do it on, only takes a few minutes to set it up really. Or alternatively covert the SQL by hand to MS SQL syntax. Is it a Snitz portal your trying to import ? maybe someone who already has that version running on MS SQL could do a SQL Dump for you.

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 07 December 2003 :  18:54:51  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
Well I have it all converted into a SQL file to run in Query Analyzer I get the following error...

Cannot insert explicit value for identity column in table 'FORUM_ADS_CATEGORY' when IDENTITY_INSERT is set to OFF.

Do I have to go thru each table and and set the Identity to No? That would take enough work itself to go thru all the tables.

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 07 December 2003 :  19:20:35  Show Profile  Visit Gremlin's Homepage
Just add it to your script

SET IDENTITY_INSERT table_name ON
GO

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 08 December 2003 :  14:06:50  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
Thank you that worked great, I used that and then after all the inserts of the records did

SET IDENTITY_INSERT table_name OFF

Only problem I have now is all the records of posts that have 's in them are causing problems with the import script. Looks like I will have to go thru each line and look at the messages

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 08 December 2003 :  18:11:08  Show Profile  Visit Gremlin's Homepage
Your getting a little further at least :)

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 08 December 2003 :  18:19:56  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
Yea but starting to look thru the 49,000 line insert file shows way to many 's in the data that would have to be changed to '' I need to figure out a way to use phpMyAdmin to export the data and move it into a new mySql that I can actually use DTS to transfer the data into MSSql

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 09 December 2003 :  01:30:45  Show Profile  Visit Gremlin's Homepage
Why not just run the SQL File through an ASP Script that does replaces for you ? use FSO to read it in line by line and do replaces in appropriate places.

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 09 December 2003 :  09:47:47  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
Well the reason why I am not sure about that is because the record sorta looks like this.

'this is the first column','column 2','more column's','last column'

so the only way i could think about doing it that i guess it to make sure its not the first or last character on the line and then before or after it doesnt have a ,

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.25 seconds. Powered By: Snitz Forums 2000 Version 3.4.07