{"id":16558,"date":"2021-07-30T07:07:12","date_gmt":"2021-07-30T05:07:12","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/"},"modified":"2021-07-30T07:07:12","modified_gmt":"2021-07-30T05:07:12","slug":"sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/","title":{"rendered":"SQL Server: &#8220;Cannot resolve the collation conflict&#8221; in a Stored Procedure"},"content":{"rendered":"<p>This week I have a new little challenge by a customer.<br \/>\nBy executing a &#8220;standard&#8221; stored procedure, I have the error:<\/p>\n<p style=\"color: red\">Msg 468, Level 16, State 9, Procedure Get_logsessions, Line 56 [Batch Start Line 119]<br \/>\nCannot resolve the collation conflict between &#8220;Latin1_General_CI_AS&#8221; and &#8220;Latin1_General_CI_AS_KS_WS&#8221; in the equal to operation.<\/p>\n<p>The Stored Procedure named Get_Logsessions is to log all sessions running on the server in a table.<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-50917 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict01.png\" alt=\"\" width=\"300\" height=\"66\" \/><\/a><\/p>\n<p>Looking with the query I develop and present you in a precedent blog <a href=\"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-compare-server-and-database-collation\/\" target=\"_blank\" rel=\"noopener\">here.<\/a><\/p>\n<p>I can see that my database collation is not the same as the instance collation<br \/>\n<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-50916 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict02.png\" alt=\"\" width=\"300\" height=\"51\" \/><\/a><\/p>\n<p>Here the script for the Procedure:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">CREATE PROCEDURE [dbo].[Get_logsessions]\nAS\nSET NOCOUNT ON\nIF OBJECT_ID(N'[dbo].[logsessions]') IS NULL\n\tBEGIN\n\t\tCREATE TABLE [dbo].[logsessions]\n\t\t\t(\n\t\t\t[clientip] varchar(48),\n\t\t\t[clientname] nvarchar(128)  ,\n\t\t\t[clientinterface] nvarchar(32) ,\n\t\t\t[app] nvarchar(128)  ,\n\t\t\t[auth] nvarchar(40) ,\n\t\t\t[login] nvarchar(128) ,\n\t\t\t[db] nvarchar(128),\n\t\t\t[firstaccess] [datetime] NULL,\n\t\t\t[lastaccess] [datetime] NULL,\n\t\t\t[count] bigint NULL\n\t\t\t)\n\tEND\n\nIF OBJECT_ID(N'tempdb..#sp_who2')  IS NOT NULL\n\tDROP TABLE #sp_who2\nIF OBJECT_ID(N'tempdb..#logsessions')  IS NOT NULL\n\tDROP TABLE #logsessions\n\n-- Use sp_who2 to be compatible with 2005 to replace [db] = db_name(b.database_id)\nCREATE TABLE #sp_who2 (SPID INT,Status VARCHAR(255) ,\n      Login  VARCHAR(255)  ,HostName  VARCHAR(255)  ,\n      BlkBy  VARCHAR(255) ,DBName  VARCHAR(255)  ,\n      Command VARCHAR(255)  ,CPUTime INT,\n      DiskIO INT,LastBatch VARCHAR(255)  ,\n      ProgramName VARCHAR(255) ,SPID2 INT,\n      REQUESTID INT)\n\nINSERT INTO #sp_who2 EXEC sp_who2\n\nSELECT DISTINCT\n\t[clientip] = a.client_net_address,\n\t[clientname] = b.host_name ,\n\t[clientinterface] = b.client_interface_name  ,\n\t[app] = b.program_name  ,\n\t[auth] = a.auth_scheme  ,\n\t[login] = b.login_name ,\n\t[db] = w.DBName  ,\n\t[firstaccess] = MIN(b.[login_time]),\n\t[lastaccess] = MAX(b.[login_time]),\n\t[count] = Count(*) \nINTO\n\t#logsessions\nFROM \n\tsys.dm_exec_connections a\n\tINNER JOIN sys.dm_exec_sessions b on a.session_id = b.session_id\n\tINNER JOIN  #sp_who2 w on w.SPID = b.session_id\nGROUP BY a.[client_net_address],b.[host_name] ,b.[client_interface_name],b.[program_name] ,a.[auth_scheme],b.[login_name],w.[DBName]\n\nUPDATE\n    b\nSET\n    b.[lastaccess] =  a.[lastaccess],\n\tb.[count] = b.[count] + 1\nFROM \n\t\t#logsessions a\n\t\tINNER JOIN [dbo].[logsessions] b\n\t\t\tON \ta.[clientip] = b.[clientip]  \n\t\t\tAND a.[clientname] = b.[clientname]  \n\t\t\tAND a.[clientinterface] = b.[clientinterface]  \n\t\t\tAND\ta.[app] = b.[app]  \n\t\t\tAND a.[auth] = b.[auth] \n\t\t\tAND a.[login] = b.[login]  \n\t\t\tAND a.[db] = b.[db] \n\tWHERE\n\t\tDATEDIFF(s,b.[lastaccess] ,a.[lastaccess]) &lt;&gt; 0\n\t\tAND\n\t\tDATEDIFF(s,b.[firstaccess] ,a.[firstaccess]) &lt;&gt; 0\n\t\tAND\n\t\tDATEDIFF(s,b.[firstaccess] ,a.[lastaccess]) &gt; 0\n\nINSERT INTO [dbo].[logsessions]\n        (\n\t\t [clientip]\n        ,[clientname]\n        ,[clientinterface]\n        ,[app]\n        ,[auth]\n        ,[login]\n        ,[db]\n\t\t,[firstaccess],\n\t\t[lastaccess],\n\t\t[count]\n\t\t)\n\t(\n\tSELECT\n\t\ta.[clientip],a.[clientname] ,a.[clientinterface],a.[app] ,a.[auth], a.[login],a.[db], a.[firstaccess],a.[lastaccess],a.count \n\tFROM #logsessions a\n\tLEFT JOIN [dbo].[logsessions] b\n\t\t\tON \ta.[clientip] = b.[clientip] \n\t\t\tAND a.[clientname] = b.[clientname]\n\t\t\tAND a.[clientinterface] = b.[clientinterface]  \n\t\t\tAND\ta.[app] = b.[app] \n\t\t\tAND a.[auth] = b.[auth]\n\t\t\tAND a.[login] = b.[login] \n\t\t\tAND a.[db] = b.[db]\n\tWHERE\n\t\tb.[clientip] IS NULL\n\t\t)\n\nDROP TABLE #logsessions\nDROP TABLE #sp_who2\n\nSET NOCOUNT OFF\nGO<\/pre>\n<p>If I comment the creation of the Stored Procedure and I execute the query , I see my collation conflict:<br \/>\n<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict03.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-50915 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict03.png\" alt=\"\" width=\"300\" height=\"233\" \/><\/a><\/p>\n<p>If I go to the line 67, I&#8217;m on the update command:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">UPDATE\n    b\nSET\n    b.[lastaccess] =  a.[lastaccess],\n\tb.[count] = b.[count] + 1\nFROM \n\t\t#logsessions a\n\t\tINNER JOIN [dbo].[logsessions] b\n\t\t\tON \ta.[clientip] = b.[clientip]  \n\t\t\tAND a.[clientname] = b.[clientname]  \n\t\t\tAND a.[clientinterface] = b.[clientinterface]  \n\t\t\tAND\ta.[app] = b.[app]  \n\t\t\tAND a.[auth] = b.[auth] \n\t\t\tAND a.[login] = b.[login]  \n\t\t\tAND a.[db] = b.[db] \n\tWHERE\n\t\tDATEDIFF(s,b.[lastaccess] ,a.[lastaccess])  0\n\t\tAND\n\t\tDATEDIFF(s,b.[firstaccess] ,a.[firstaccess])  0\n\t\tAND\n\t\tDATEDIFF(s,b.[firstaccess] ,a.[lastaccess]) &gt; 0\n<\/pre>\n<p>The conflict comes from the update from the table #logsessions to logsessions and the collation from the comparison between the varchar columns from each table in the join.<br \/>\nWhat can I do?<\/p>\n<p>I will simply aligned the collation for each column with<\/p>\n<p style=\"color: red\"><strong>COLLATE DATABASE_DEFAULT<\/strong><\/p>\n<p>My new update will be like this:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">UPDATE\n    b\nSET\n    b.[lastaccess] =  a.[lastaccess],\n\tb.[count] = b.[count] + 1\nFROM \n\t\t#logsessions a\n\t\tINNER JOIN [dbo].[logsessions] b \n\t\t\tON \ta.[clientip] = b.[clientip]\t\t\t\t\tCOLLATE DATABASE_DEFAULT\n\t\t\tAND a.[clientname] = b.[clientname]\t\t\t\tCOLLATE DATABASE_DEFAULT\n\t\t\tAND a.[clientinterface] = b.[clientinterface]\tCOLLATE DATABASE_DEFAULT\n\t\t\tAND\ta.[app] = b.[app]\t\t\t\t\t\t\tCOLLATE DATABASE_DEFAULT\n\t\t\tAND a.[auth] = b.[auth]\t\t\t\t\t\t\tCOLLATE DATABASE_DEFAULT\n\t\t\tAND a.[login] = b.[login]\t\t\t\t\t\tCOLLATE DATABASE_DEFAULT\n\t\t\tAND a.[db] = b.[db]\t\t\t\t\t\t\t\tCOLLATE DATABASE_DEFAULT\n\tWHERE\n\t\tDATEDIFF(s,b.[lastaccess] ,a.[lastaccess])  0\n\t\tAND\n\t\tDATEDIFF(s,b.[firstaccess] ,a.[firstaccess])  0\n\t\tAND\n\t\tDATEDIFF(s,b.[firstaccess] ,a.[lastaccess]) &gt; 0\n\n\n<\/pre>\n<p>And when I execute the script, no more conflict<br \/>\n<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict04.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-50914 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict04.png\" alt=\"\" width=\"283\" height=\"300\" \/><\/a><\/p>\n<p>I do an alter Store Procedure and execute this new one:<br \/>\n<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict05.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-50913 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict05.png\" alt=\"\" width=\"300\" height=\"136\" \/><\/a><\/p>\n<p>Perfect no more collation conflict!<br \/>\nI think that is important to share with you this issue and hope you will win time if you need to resolve a similar case.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week I have a new little challenge by a customer. By executing a &#8220;standard&#8221; stored procedure, I have the error: Msg 468, Level 16, State 9, Procedure Get_logsessions, Line 56 [Batch Start Line 119] Cannot resolve the collation conflict between &#8220;Latin1_General_CI_AS&#8221; and &#8220;Latin1_General_CI_AS_KS_WS&#8221; in the equal to operation. The Stored Procedure named Get_Logsessions is [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":16563,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229],"tags":[],"type_dbi":[],"class_list":["post-16558","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database-administration-monitoring"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>SQL Server: &quot;Cannot resolve the collation conflict&quot; in a Stored Procedure - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server: &quot;Cannot resolve the collation conflict&quot; in a Stored Procedure\" \/>\n<meta property=\"og:description\" content=\"This week I have a new little challenge by a customer. By executing a &#8220;standard&#8221; stored procedure, I have the error: Msg 468, Level 16, State 9, Procedure Get_logsessions, Line 56 [Batch Start Line 119] Cannot resolve the collation conflict between &#8220;Latin1_General_CI_AS&#8221; and &#8220;Latin1_General_CI_AS_KS_WS&#8221; in the equal to operation. The Stored Procedure named Get_Logsessions is [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-30T05:07:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict05.png\" \/>\n\t<meta property=\"og:image:width\" content=\"410\" \/>\n\t<meta property=\"og:image:height\" content=\"186\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"St\u00e9phane Haby\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"St\u00e9phane Haby\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/\"},\"author\":{\"name\":\"St\u00e9phane Haby\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/d0bfb7484ae81c8980fc2b11334f803b\"},\"headline\":\"SQL Server: &#8220;Cannot resolve the collation conflict&#8221; in a Stored Procedure\",\"datePublished\":\"2021-07-30T05:07:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/\"},\"wordCount\":250,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict05.png\",\"articleSection\":[\"Database Administration &amp; Monitoring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/\",\"name\":\"SQL Server: \\\"Cannot resolve the collation conflict\\\" in a Stored Procedure - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict05.png\",\"datePublished\":\"2021-07-30T05:07:12+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/d0bfb7484ae81c8980fc2b11334f803b\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#primaryimage\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict05.png\",\"contentUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict05.png\",\"width\":410,\"height\":186},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server: &#8220;Cannot resolve the collation conflict&#8221; in a Stored Procedure\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/d0bfb7484ae81c8980fc2b11334f803b\",\"name\":\"St\u00e9phane Haby\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/1123227ca39a5dca608c0f72d23cd1904fee29979749bbb3a485b9438436c553?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1123227ca39a5dca608c0f72d23cd1904fee29979749bbb3a485b9438436c553?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1123227ca39a5dca608c0f72d23cd1904fee29979749bbb3a485b9438436c553?s=96&d=mm&r=g\",\"caption\":\"St\u00e9phane Haby\"},\"description\":\"St\u00e9phane Haby has more than ten years of experience in Microsoft solutions. He is specialized in SQL Server technologies such as installation, migration, best practices, and performance analysis etc. He is also an expert in Microsoft Business Intelligence solutions such as SharePoint, SQL Server and Office. Futhermore, he has many years of .NET development experience in the banking sector and other industries. In France, he was one of the first people to have worked with Microsoft Team System. He has written several technical articles on this subject. St\u00e9phane Haby is Microsoft Most Valuable Professional (MVP) as well as Microsoft Certified Solutions Associate (MCSA) and\u00a0Microsoft Certified Solutions Expert (MCSE) for SQL Server 2012. He is also Microsoft Certified Technology Specialist (MCTS) and Microsoft Certified IT Professional (MCITP) for SQL Server 2008 as well as ITIL Foundation V3 certified. He holds a Engineer diploma in industrial computing and automation from France. His branch-related experience covers Chemicals &amp; Pharmaceuticals, Banking \/ Financial Services, and many other industries.\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/stephane-haby\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL Server: \"Cannot resolve the collation conflict\" in a Stored Procedure - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server: \"Cannot resolve the collation conflict\" in a Stored Procedure","og_description":"This week I have a new little challenge by a customer. By executing a &#8220;standard&#8221; stored procedure, I have the error: Msg 468, Level 16, State 9, Procedure Get_logsessions, Line 56 [Batch Start Line 119] Cannot resolve the collation conflict between &#8220;Latin1_General_CI_AS&#8221; and &#8220;Latin1_General_CI_AS_KS_WS&#8221; in the equal to operation. The Stored Procedure named Get_Logsessions is [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/","og_site_name":"dbi Blog","article_published_time":"2021-07-30T05:07:12+00:00","og_image":[{"width":410,"height":186,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict05.png","type":"image\/png"}],"author":"St\u00e9phane Haby","twitter_card":"summary_large_image","twitter_misc":{"Written by":"St\u00e9phane Haby","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/"},"author":{"name":"St\u00e9phane Haby","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/d0bfb7484ae81c8980fc2b11334f803b"},"headline":"SQL Server: &#8220;Cannot resolve the collation conflict&#8221; in a Stored Procedure","datePublished":"2021-07-30T05:07:12+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/"},"wordCount":250,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict05.png","articleSection":["Database Administration &amp; Monitoring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/","url":"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/","name":"SQL Server: \"Cannot resolve the collation conflict\" in a Stored Procedure - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict05.png","datePublished":"2021-07-30T05:07:12+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/d0bfb7484ae81c8980fc2b11334f803b"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict05.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Collation_conflict05.png","width":410,"height":186},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-cannot-resolve-the-collation-conflict-in-a-stored-procedure\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SQL Server: &#8220;Cannot resolve the collation conflict&#8221; in a Stored Procedure"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/d0bfb7484ae81c8980fc2b11334f803b","name":"St\u00e9phane Haby","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1123227ca39a5dca608c0f72d23cd1904fee29979749bbb3a485b9438436c553?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1123227ca39a5dca608c0f72d23cd1904fee29979749bbb3a485b9438436c553?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1123227ca39a5dca608c0f72d23cd1904fee29979749bbb3a485b9438436c553?s=96&d=mm&r=g","caption":"St\u00e9phane Haby"},"description":"St\u00e9phane Haby has more than ten years of experience in Microsoft solutions. He is specialized in SQL Server technologies such as installation, migration, best practices, and performance analysis etc. He is also an expert in Microsoft Business Intelligence solutions such as SharePoint, SQL Server and Office. Futhermore, he has many years of .NET development experience in the banking sector and other industries. In France, he was one of the first people to have worked with Microsoft Team System. He has written several technical articles on this subject. St\u00e9phane Haby is Microsoft Most Valuable Professional (MVP) as well as Microsoft Certified Solutions Associate (MCSA) and\u00a0Microsoft Certified Solutions Expert (MCSE) for SQL Server 2012. He is also Microsoft Certified Technology Specialist (MCTS) and Microsoft Certified IT Professional (MCITP) for SQL Server 2008 as well as ITIL Foundation V3 certified. He holds a Engineer diploma in industrial computing and automation from France. His branch-related experience covers Chemicals &amp; Pharmaceuticals, Banking \/ Financial Services, and many other industries.","url":"https:\/\/www.dbi-services.com\/blog\/author\/stephane-haby\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/16558","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=16558"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/16558\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/16563"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=16558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=16558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=16558"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=16558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}