Home
%3CLINGO-SUB%20id%3D%22lingo-sub-744183%22%20slang%3D%22en-US%22%3ELesson%20Learned%20%2397%3A%20Which%20is%20the%20server%20collation%20in%20Azure%20SQL%20Database%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-744183%22%20slang%3D%22en-US%22%3E%3CP%3EToday%2C%20I%20worked%20on%20a%20case%20that%20our%20customer%20reported%20that%20importing%20a%20bacpac%20they%20got%20a%20duplicate%20object%20name%2C%20however%2C%20if%20they%20import%20the%20bacpac%20in%20a%20SQL%20Server%20OnPremise%20the%20process%20is%20completed%20without%20issues%20but%20Azure%20SQL%20Database%20they%20faced%20the%20following%20error%3A%20%26nbsp%3BImport%20fails%20'Error%20SQL72014%3A%20Procedure%20ExampleFunction%2C%20Line%203%20There%20is%20already%20an%20object%20named%20'ExampleFunction'%20in%20the%20database'.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI'm%20asking%20why%20this%20difference%20and%20following%20I%20would%20like%20to%20share%20with%20you%20my%20lessons%20learned%20here%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EI%20changed%20the%20extension%20of%20the%20bacpac%20file%20to%20zip%20and%20I%20found%20that%2C%20indeed%2C%20we%20have%20two%20procedures%20with%20same%20name%20but%20one%20is%20written%20Examplefunction%20and%20another%20one%20is%20ExampleFunction.%3C%2FLI%3E%0A%3CLI%3EIn%20the%20model.xml%20of%20this%20bacpac%20file%20I%20found%20that%20the%20collation%20of%20the%20database%20is%20LATIN1_GENERAL_BIN%20that%20is%20case%20sensitive%20and%20after%20asking%20to%20our%20customer%20we%20found%20that%20the%20server%20configuration%20iss%20indeed%20LATIN1_GENERAL_BIN%20so%2C%20this%20is%20the%20reason%2C%20that%20our%20customer%20is%20not%20getting%20any%20error%20having%20two%20procedures%20with%20same%20name%20but%20written%20different.%3C%2FLI%3E%0A%3CLI%3EIn%20fact%2C%20running%20the%20query%20select%20*%20from%20sys.columns%2C%20I%20found%20that%20the%20system%20table%20sysschobjs%26nbsp%3Bthat%20is%20managing%20the%20name%20is%20LATIN1_GENERAL_BIN.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122669i6B8241041D4B3904%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22database1.jpg%22%20title%3D%22database1.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EBut%2C%20what%20is%20happening%20with%20Azure%20SQL%20Database%3F%3CUL%3E%0A%3CLI%3EFirst%2C%20I%20checked%20the%20collation%20of%20Azure%20SQL%20Database%20and%20I%20found%20that%20the%20collation%20of%20the%20database%20is%20indeed%2C%20LATIN1_GENERAL_BIN.%3C%2FLI%3E%0A%3CLI%3ESecond%2C%20I%20checked%20the%20collation%20of%20Azure%20SQL%20Server%20and%20I%20found%20that%20the%20collation%20of%20the%20server%20is%20SQL_Latin1_General_CP1_CI_AS%20that%20is%20case%20insensitive%20and%20for%20this%20error%20our%20customer%20is%20facing%20this%20error.%20Unfortunately%2C%20this%20definition%20is%20by%20design%20and%20nowadays%20it%20is%20not%20possible%20to%20change.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122670iC9438F33385C432F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22database2.jpg%22%20title%3D%22database2.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEnjoy!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-744183%22%20slang%3D%22en-US%22%3E%3CP%3EToday%2C%20I%20worked%20on%20a%20case%20that%20our%20customer%20reported%20that%20importing%20a%20bacpac%20they%20got%20a%20duplicate%20object%20name%2C%20however%2C%20if%20they%20import%20the%20bacpac%20in%20a%20SQL%20Server%20OnPremise%20the%20process%20is%20completed%20without%20issues%20but%20Azure%20SQL%20Database%20they%20faced%20the%20following%20error%3A%20%26nbsp%3BImport%20fails%20'Error%20SQL72014%3A%20Procedure%20ExampleFunction%2C%20Line%203%20There%20is%20already%20an%20object%20named%20'ExampleFunction'%20in%20the%20database'.%3C%2FP%3E%3C%2FLINGO-TEASER%3E

Today, I worked on a case that our customer reported that importing a bacpac they got a duplicate object name, however, if they import the bacpac in a SQL Server OnPremise the process is completed without issues but Azure SQL Database they faced the following error:  Import fails 'Error SQL72014: Procedure ExampleFunction, Line 3 There is already an object named 'ExampleFunction' in the database'.

 

I'm asking why this difference and following I would like to share with you my lessons learned here:

 

  • I changed the extension of the bacpac file to zip and I found that, indeed, we have two procedures with same name but one is written Examplefunction and another one is ExampleFunction.
  • In the model.xml of this bacpac file I found that the collation of the database is LATIN1_GENERAL_BIN that is case sensitive and after asking to our customer we found that the server configuration iss indeed LATIN1_GENERAL_BIN so, this is the reason, that our customer is not getting any error having two procedures with same name but written different.
  • In fact, running the query select * from sys.columns, I found that the system table sysschobjs that is managing the name is LATIN1_GENERAL_BIN.

 

database1.jpg

 

  • But, what is happening with Azure SQL Database?
    • First, I checked the collation of Azure SQL Database and I found that the collation of the database is indeed, LATIN1_GENERAL_BIN.
    • Second, I checked the collation of Azure SQL Server and I found that the collation of the server is SQL_Latin1_General_CP1_CI_AS that is case insensitive and for this error our customer is facing this error. Unfortunately, this definition is by design and nowadays it is not possible to change.

 

database2.jpg

 

Enjoy!