Re: solved mySQL to MSSQL partially now i need a quick TSQL solution to solve the end part ( is there a Kalen Delany over here :-)

From: John Bell (jbellnewsposts_at_hotmail.com)
Date: 02/05/05


Date: Sat, 5 Feb 2005 10:22:15 -0000

Hi

If this is a one off you may want to try something like:

For an output file per input file (should be zero length if worked!):
FOR %f IN ("*.sql") DO osql -U <UserName> -P <password> -S <Server> -d
<Database> -n -i %f -o %~nf.txt

For a single output file (using a trusted connection on the default
instance):
for %i in (*.sql) do osql -E -d <database> -n -i%i >> outputfile.txt

or a quicker method as it does not create a new connection for each file is
to list the files in a script using the :r option

for %i in (*.sql) do echo :r %i >> Myfiles.sql
osql -E -d <database> -n -i MyFiles.sql -o outputfile.txt

John

"M. Posseth" <michelp@nohausystems.nl> wrote in message
news:cu26an$2sr$1@reader11.wxs.nl...
> Hi ,,,
>
>
> It is me again the guy that wanted to import a MYSQL dump file into MSSQL
> server
>
> The problem was that this file is 7 GB big and i could not even open it in
> the query analyzer ( or even in notepad :-) ) also the SQL syntax of
> MYSQL
> is different as MSSQL
>
>
> However that part is now solved as i am also a Visual studio Programmer i
> wrote a program that can open the 7 GB dump file and that will make a
> syntax
> change from MYSQL to SQL wich Microsoft`s SQL server seems to understand
> :-)
>
>
> well what the heck is now my problem ???
>
>
> Well that 7 GB file is now chopped in a few hundred small SQL files (
> wich
> i tested a few in SQL server query analyzer and do work in MSSQL server )
> i would like to know the folowing
>
> 1. is it possible to write a stored procedure that can execute these IO
> based SQL scripts , and how ?
>
> 2. or can i use OSQL to load these scripts to my sql server ??
>
> and then the most important question how big can i make these files ,,, at
> this moment i limited them to 10.000 records but there are millions in
> the
> original MYSQL file ( 28 million i believe )
>
>
> maybe it is possible to skip the hole IO thingy and execute the SQL direct
> through a SQL connection however then again the question is how big can i
> make the string to send through the wire
>
> Hope that a Pseudo Kalen will stand up and can answer this for me
>
>
> after i finished this project i will write a nice GUI wrapper around it
> and
> publish the source and exe for who might be interested in this solution (
> import a MYSQL dump to MSSQL )
>
>
> Michel Posseth [MCP]
>
>
>



Relevant Pages

  • RE: Invalid cursor state when using PRINT in MSSQL
    ... SQL> print 'start' select 1 ... Running your Perl code to my SQL Server with my DSN etc I get: ... You go try turning on ODBC tracing in the driver manager, ... > The server and all the SP's I am running this on is MSSQL and not Sybase. ...
    (perl.dbi.users)
  • Re: solved mySQL to MSSQL partially now i need a quick TSQL solution to solve the end part ( is ther
    ... >> It is me again the guy that wanted to import a MYSQL dump file into MSSQL ... >> change from MYSQL to SQL wich Microsoft`s SQL server seems to ... >> i tested a few in SQL server query analyzer and do work in MSSQL ...
    (microsoft.public.sqlserver.programming)
  • Re: The connection is dead
    ... I have been there,, however in my case it was a 7,5 gigabyte mysql dump ... database that i needed to import in SQL server 2000 ... run the DDL SQL and batch inserted a few hundred records at once to MSSQL. ... > I'm moving all the tables in a remote informix database to a local sql ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Cant Connect
    ... Microsoft Access to my SQL database, do i need to create a MSSQL client ... settings SQL server does not allow remote connections (provider: ... 0 - No connection could be made because the target ...
    (microsoft.public.sqlserver.connect)
  • Re: import mysql dump file in sql server
    ... >> The dump file is 7 gig big however my MS SQL server is a DELL ... my MSSQL server on this mysql dump file so i can import it. ...
    (microsoft.public.sqlserver.programming)