Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
louis.bacon
Starting Member
3 Posts |
Posted - 2009-02-09 : 06:17:43
|
| Hi Guys,This is my first post here so be gentle. I have a stored procedure that creates a table variable and inserts some data from x,y,z tables. What I want to be able to do now is to dump this data to a .sql file so that I can then transport and import it into a mysql database elsewhere. Is this the best method to use? Also does anyone know where I can find such a piece of SQL code? Many Thanks in advance!Louis |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2009-02-09 : 07:35:51
|
| Why not just do a SELECT from the table variable at the end of your stored proc and then deal with the output in the usual ways?Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2009-02-09 : 08:31:58
|
Can you parse an XML document -- probably the most portable container I can think of?you could do a SELECT <blah> FOR XML to output an XML fileCheck out FOR XML in books online for how to set it up exactly as you would want.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
louis.bacon
Starting Member
3 Posts |
Posted - 2009-02-09 : 09:21:46
|
quote: Originally posted by Transact Charlie Can you parse an XML document -- probably the most portable container I can think of?you could do a SELECT <blah> FOR XML to output an XML fileCheck out FOR XML in books online for how to set it up exactly as you would want.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
but wouldn't you then need to use some form of xml parser at the other end like in php?i would prefer to use something else to import to mysql. such as a t-sql script or a ruby app. |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2009-02-09 : 11:05:56
|
I'm afraid that I don't know what tools you'll have available to you when importing into MySql but I'd be surprised if there aren't a whole bunch of XML parser's available for it.I think you might want to ask this question on a MySQL forum. It sounds like the problem is not getting information OUT of the TSQL database but knowing how that information needs to be presented.quote: ... now is to dump this data to a .sql
Do you mean that you want to input the data as a sequence of?INSERT x SELECT y UNION SELECT z That's really not efficient and depending on your data you can run into a slew of problems with file encoding.it would probably be easier to output the data to a file in a relevent format (if you only need ascii text then what about comma seperated?) then use whatever bulk import tools are available in MySql.(this is why I recommended XML) -- It's an open standard so I'm sure MySql (or a free tool written to use MySQL will import it for you). I don't use Mysql so can't tell you.Maybe try http://forums.mysql.com/ ??Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
|
|
|
|
|