attics of my lifethe story of me |
|
|
backup.rake and MySQL to SQLServer 2005
09.14.2006 07:34 PM
Just in case anyone else ever has to do this. I had a project that required me to move from MySQL to SQLServer 2005 and thought that I would use backup.rake from tobi to dump the data and import it back in to SQL Server. During this I ran into an identity insert problem with SQL Server. The fix is to change the backup.rake file to set identity insert on and off for each table. Like this for insert:
if ActiveRecord::Base.connection.adapter_name == "SQLServer"
ActiveRecord::Base.connection.execute "SET IDENTITY_INSERT dbo.#{tbl} ON"
end
Not being a SQL Server guy, I don't know why you have to include the "dbo.#{tbl}" but you do, "#{tbl}" didn't work. Another thing I noticed in going to RubyDBI from MySQL is that if you are using text columns set them to default to NULL. See this bug report for RubyDBI for details. There are 0 Comments for backup.rake and MySQL to SQLServer 2005Add A Comment |
|
© atticsofmylife.net |
|