Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Raised from #1828950: Update to alpha7 database update fails on MSSQL and probably also root cause of #1645306: Running update script on Feeds results in error. It seems that this failure also leaves columnname_old in the database.
Comment | File | Size | Author |
---|---|---|---|
#9 | _sqlsrv-explicit_cast_convert-1830024-9.patch | 777 bytes | Uncle_Code_Monkey |
#3 | 1830024-sqlsvr-migrate-field.patch | 1005 bytes | lyricnz |
#1 | 1830024-sqlsvr-migrate-field.patch | 1004 bytes | lyricnz |
Comments
Comment #1
lyricnz CreditAttribution: lyricnz commentedAccording to http://msdn.microsoft.com/en-us/library/ms187928.aspx there are a number of conversions that must be made explicitly (see the "Implicit Conversions" section). If we restrict that table to only the (13) data types used by sqlsvr, the only problematic conversions are those from date+datetime2+nchar+nvarchar+time to varbinary(max). Only the nchar+nvarchar cases are realistic.
I started this in attached patch, but (a) I don't have any SQL Server to test on, and (b) I don't know how to check the old field spec to determine if it's nchar+nvarchar (is it safe to ask for the schema from in here).
So, marking this as CNW pending someone with any clue about SQL Server at all :)
Comment #2
lyricnz CreditAttribution: lyricnz commentedComment #3
lyricnz CreditAttribution: lyricnz commentedMissing a close-bracket, at least.
Comment #4
katannshaw CreditAttribution: katannshaw commentedThanks for the patch lyricnz. I'll give it a try first thing Monday morning and I'll let you know what happens. It's much appreciated.
Comment #5
lyricnz CreditAttribution: lyricnz commentedThe patch is probably incomplete - it will use CAST() whether it needs to or not, when migrating to varbinary(max)
Comment #6
katannshaw CreditAttribution: katannshaw commentedOk, thanks for letting me know. Would you prefer for me to wait until it's complete, or would you like for me to test it out?
Comment #7
lyricnz CreditAttribution: lyricnz commentedI have no way of testing it. Go for it.
Comment #8
Damien Tournoud CreditAttribution: Damien Tournoud commentedIs there any reason not to always use an explicit cast? After all, an implicit cast is... a cast too, just implicit.
Comment #9
Uncle_Code_Monkey CreditAttribution: Uncle_Code_Monkey commentedMy error happened to be when updating CTools (
data
field inctools_object_cache
changed from varchar to varbinary). I modified the patch to always use an explicit cast since Damien made sense with his observation. Tested on my site and verified that it fixes my issue and did not cause any others.FYI, don't forget to apply this patch to the sqlsrv module and then copy the entire sqlsrv subfolder to
%site%/includes/database
so the change actually gets used.Comment #10
thorsten. CreditAttribution: thorsten. commentedThx for the patch!
Comment #11
gabriel.achille CreditAttribution: gabriel.achille commentedit is working for me too. Thanks.
Comment #12
omegamonk CreditAttribution: omegamonk commentedThanks for the patch. It has been committed to the development release.