Unanswered: importing data from sql server to mysql
I have a huge database that is in sql server, and now I'm converting to mysql. I have all the tables created in mysql now I want to import the data that is in sql server into the mysql tables. Is there an easy way to do this? If someone can help, please do so. And another thing, could someone give me a sample of an If else statement.
This is what I have and I keep getting an error.
set @var = 1;
if not (@var = 0) then
select * from table1
select * from table2
I am assuming that the tables have the same definition. If they do, then you can use the following code to accomplish the task:
CREATE TEMPORARY TABLE omega
SELECT * FROM table1;
ALTER TABLE omega ADD COLUMN tablename INT;
UPDATE omega SET tablename = 1;
INSERT INTO omega(<columnlist omitting tablenamet>) SELECT * FROM table2;
UPDATE omega SET tablename = 2 WHERE tablename IS NULL;
SET @tableid = IF(@var=0, 2, 1);
SELECT * FROM omega WHERE tablename = @tableid;
By "accomplish this task" I meant to replace the If-Then statement. Just use the code I wrote in place of an If-Then statement (changing the <> to the real column names).
But to get the data from SQL Server into MySQL you probably need to use DTS. Follow the wizard through and your data should move just fine. If you need more help on DTS, the SQL Server forum is probably a better place to ask.