473,713 Members | 2,743 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

import .sql script into sql server

jet
Hi,

Maybe this is an easy task, but I'm having a really hard time figuring
out how to do this. I'm a complete newbie to SQL Server.

I have a database dump file from MySQL that's in .sql format. I'm
trying to figure out how to import that into SQL Server 2000 so that
I'll be able to manipulate it in a gui format, rather than command
line. I can't find any import that takes a .sql file. I've been
trying to load it into the query analyzer and am also having problems
with that. Initially I had problems because there were question marks
within some of my data. I've removed those but when I run the query I
still get a bunch of syntax errors. Looking at the errors, the syntax
seems correct.

Does anyone know of a way to import a .sql script without having to
import it into the query analyzer? It seems like it should be a
no-brainer..... but perhaps my brain is lacking... I don't know!

Thanks for the help!

--jet
the following are the errors that I get and the associated code:
-----------------------------------------------------------------------------
Server: Msg 170, Level 15, State 1, Line 17
Line 17: Incorrect syntax near ','.

CODE: INSERT INTO answers VALUES
('travelMethodR adio','j******* ***@montana.com ','telemark'),

The second line is line 17, and it is followed by more insert values.
------------------------------------------------------------------------------
Server: Msg 170, Level 15, State 1, Line 7093
Line 7093: Incorrect syntax near 'a'.

CODE: ('groupSlopeTra velText','k**** *****@jhmg.com' ,'This is
completely dependent on conditions and if it is a heavily used area or
a fairly pristine area'),

This is just one in a long list of insert values... no idea why there
is a problem with this particular one.
-------------------------------------------------------------------------------
Jul 20 '05 #1
2 22711

"jet" <je*********@ya hoo.com> wrote:
Hi,

Maybe this is an easy task, but I'm having a really hard time figuring
out how to do this. I'm a complete newbie to SQL Server.

I have a database dump file from MySQL that's in .sql format. I'm
trying to figure out how to import that into SQL Server 2000 so that
I'll be able to manipulate it in a gui format, rather than command
line. I can't find any import that takes a .sql file. I've been
trying to load it into the query analyzer and am also having problems
with that. Initially I had problems because there were question marks
within some of my data. I've removed those but when I run the query I
still get a bunch of syntax errors. Looking at the errors, the syntax
seems correct.

Does anyone know of a way to import a .sql script without having to
import it into the query analyzer? It seems like it should be a
no-brainer..... but perhaps my brain is lacking... I don't know!

Thanks for the help!

--jet
the following are the errors that I get and the associated code:
-------------------------------------------------------------------------- --- Server: Msg 170, Level 15, State 1, Line 17
Line 17: Incorrect syntax near ','.

CODE: INSERT INTO answers VALUES
('travelMethodR adio','j******* ***@montana.com ','telemark'),

The second line is line 17, and it is followed by more insert values.
-------------------------------------------------------------------------- ---- Server: Msg 170, Level 15, State 1, Line 7093
Line 7093: Incorrect syntax near 'a'.

CODE: ('groupSlopeTra velText','k**** *****@jhmg.com' ,'This is
completely dependent on conditions and if it is a heavily used area or
a fairly pristine area'),

This is just one in a long list of insert values... no idea why there
is a problem with this particular one.
--------------------------------------------------------------------------

-----

jet,

Before answering your question... if you use the ODBC driver for MySQL, you
can use SQL Server DTS to get table structure and data to/from MySQL. IMHO,
it's much easier that way. However, to answer your question...

The problem you're having would be the same going from SQL Server back to
MySQL: they both use extensions to SQL. Query Analyzer is definitely the
tool to use if you want to run a MySQL .sql file vs your SQL Server.
However, some things to keep in mind..

- Neither SQL Server nor Query Analyzer recognize "#" as a comment
character: use "--" instead.

- MySQL escapes single quotes in a string literal with a backslash (\'): SQL
Server escapes them with an extra single quote ('').

- MySQL allows you to "chain" records for an insert (this is the error
you're getting above). When I generate a SQL file from MySQL I use
phpMyAdmin and if I de-select the option "Extended Inserts" it generates an
insert per record instead of a single insert (what you want for SQL Server).
Basically, you're getting the error because you're trying

INSERT SomeTable VALUES ('a1', 'a2', a3'), ('b1', 'b2', b3')

when you want

INSERT SomeTable VALUES ('b1', 'b2', b3')
INSERT SomeTable VALUES ('a1', 'a2', a3')

Hope this helps!

Craig
Jul 20 '05 #2
Jet,
If you are a newbie to MS SQL Server 2000 and want to get up to speed
really quickly, our videos give you expert instruction on what you really
need to know about SQL Server. It's like reading a 1200 page book in a few
hours.
To answer your question below, a great way to do this is by using a DTS
package. It's easy to write, makes importing as simple as Excel, and can be
re-used.

For full info and examples of using a DTS package, download our videos at
www.technicalVideos.net
Best regards,
Chuck Conover
www.TechnicalVideos.net

"jet" <je*********@ya hoo.com> wrote in message
news:c3******** *************** ***@posting.goo gle.com...
Hi,

Maybe this is an easy task, but I'm having a really hard time figuring
out how to do this. I'm a complete newbie to SQL Server.

I have a database dump file from MySQL that's in .sql format. I'm
trying to figure out how to import that into SQL Server 2000 so that
I'll be able to manipulate it in a gui format, rather than command
line. I can't find any import that takes a .sql file. I've been
trying to load it into the query analyzer and am also having problems
with that. Initially I had problems because there were question marks
within some of my data. I've removed those but when I run the query I
still get a bunch of syntax errors. Looking at the errors, the syntax
seems correct.

Does anyone know of a way to import a .sql script without having to
import it into the query analyzer? It seems like it should be a
no-brainer..... but perhaps my brain is lacking... I don't know!

Thanks for the help!

--jet
the following are the errors that I get and the associated code:
-------------------------------------------------------------------------- --- Server: Msg 170, Level 15, State 1, Line 17
Line 17: Incorrect syntax near ','.

CODE: INSERT INTO answers VALUES
('travelMethodR adio','j******* ***@montana.com ','telemark'),

The second line is line 17, and it is followed by more insert values.
-------------------------------------------------------------------------- ---- Server: Msg 170, Level 15, State 1, Line 7093
Line 7093: Incorrect syntax near 'a'.

CODE: ('groupSlopeTra velText','k**** *****@jhmg.com' ,'This is
completely dependent on conditions and if it is a heavily used area or
a fairly pristine area'),

This is just one in a long list of insert values... no idea why there
is a problem with this particular one.
--------------------------------------------------------------------------

-----
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1750
by: John F Dutcher | last post by:
Having 'cloned' an existing python script that imports 'string' and uses "string.rstrip()" without incident... I am at a loss to explain why the new 'cloned' script (brief sample below) continually errors with: NameError: global name 'string' is not defined args = ("global name 'string' is not defined",) when run from the server CGI-BIN. If the same script is run in 'IDLE' it
1
1590
by: yazzoo | last post by:
I've been banging my head over a long running script that has suddenly stopped working when my ISP upgraded Apache and Suexec. They didn't specify what they did, but I presume it was the latest updates. My problem is that any script that tries to import cgi.py breaks. For example, the following script: #!/usr/bin/python print """Content-type: text/html\n\n"""
3
6272
by: Doug Baroter | last post by:
Hi, One of my clients has the following situation. They use Access DB for data update etc. some business functions while they also want to view the Access data quickly and more efficiently in SQL Server 2000. Huge Access db with over 100 user tables, over 60 MB data. The DTS package that comes with SQL Server 2000 seems pretty "messy" in the sense that it assumes that one needs to do one time import only or accurately it does not...
10
2560
by: shumaker | last post by:
I don't need a detailed description of a solution(although I wouldn't mind), but I am hoping someone could tell me in general the best path to go about accomplishing a task, since I don't know all the capabilities of what I have available. I can learn the details myself I think. I am trying to set this up to be as simple to use as possible since others will be importing data on a weekly or daily basis. I need to import some text files,...
1
4071
by: D. Shane Fowlkes | last post by:
Tw part question: 1 - Is it <% @Import Namespace..... or <%@ Import Namespace... ? I'm seeing it both ways in a book (but I think one is a typo. My pages don't seem to care which it is. Or do they?....see below 2 - I'm trying to import the namespaces of System.Data and System.Data.SQLClient in the global.asax file so I don't have to do this on each page using SQL Server commands and data. But it doesn't seem to work. I read you can...
2
3374
by: s.hong | last post by:
Hello? On the ASP.NET, I can use the class by import declation on the top of page. <%@ page language="vb" explicit="true" aspcompat="false" debug="true"%> <%@ import namespace="System.Data" %> <%@ import namespace="System.Data.SqlClient" %> It's work well for the compiled class files in /bin folder.
1
4243
by: geoffblanduk_nospam | last post by:
Using Apache Tomcat 5.0.28 I'm having a problem with the xsl:import command. I have several Tomcat running on the same server (they could be different releases of code so can't share resources). An XSLT script is called via a JSP to convert XML to HTML (<xsl:apply nameXml="routesummary" xsl="/xsl/routesummaryheader.xsl" />). This routesummaryheader.xsl script then needs to call another XSLT
3
2435
by: gatoruss | last post by:
Newbie here with a (hopefully not) dumb question....tried searching around on the 'Net without success, so here goes.... I have been playing around with python. I wrote a script that sends an smtp email. Here is the link that I found explaining how such a script could be written Sending an Email As you see it imports a module as follows: "import smtplib". I am using a linux machine (ubuntu ditro). It has both python2.5 and python2.4...
0
9876
by: A3AN | last post by:
Hi. I receive a database backup on a daily basis. I then import this dump on another server which I use for software development. There is two db's being hosted on this server. We test software upgrades against these two db's. The "refresh" needs to be completed at least once a day, sometimes 4-5 times a day. I need the quickest way of doing this task. I have extremely limited knowledge on scripting. What I need is something that I can just...
0
8795
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8701
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9306
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9168
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9068
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7942
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5943
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4715
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.