<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: sql_variant data type in Lookup activity in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/sql-variant-data-type-in-Lookup-activity/m-p/4763196#M10919</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/450914"&gt;@ryand009&lt;/a&gt;&amp;nbsp;, Thank you for reaching out to the Microsoft Community Forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Microsoft Fabric doesn't support the sql_variant data type in pipeline activities like Lookup. When your stored procedure returns a sql_variant as an output parameter, Fabric fails to interpret it since it expects outputs to have a clearly defined, supported SQL type, like datetime, bigint, varchar, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To work around this, you need to introduce a wrapper stored procedure. The wrapper should call your original procedure and explicitly convert the sql_variant output to a supported type before returning it. Instead of returning the value as an output parameter, the wrapper should return the final result using a SELECT statement. This way, Fabric can read the output as a standard, well-defined scalar value, which will work smoothly in your Lookup activity.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have control over the original stored procedure, the better long-term solution would be to avoid using sql_variant altogether and return the result directly with a SELECT, already cast to the appropriate type.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-factory/tutorial-preprocess-data-with-stored-procedure-load-into-lakehouse" target="_blank"&gt;Preprocess data with a stored procedure before loading into Lakehouse - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Jul 2025 07:20:20 GMT</pubDate>
    <dc:creator>v-hashadapu</dc:creator>
    <dc:date>2025-07-15T07:20:20Z</dc:date>
    <item>
      <title>sql_variant data type in Lookup activity</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/sql-variant-data-type-in-Lookup-activity/m-p/4762563#M10898</link>
      <description>&lt;P class=""&gt;Hello&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;I’ve got a stored procedure that can return a student’s date of birth either as a date or as in bigInt (i.e.&amp;nbsp; number of seconds from Jan 1 1970).&amp;nbsp; The @outputValue in the procedure is a SQL_VARIANT data type&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;The date/ bigInt return value is based on the input parameter @returnType, see below ...&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Trouble is Microsoft Fabric doesn’t seem to like SQL_VARIANT. I’m using the query below in a Lookup activity, but it keeps falling over because of the SQL_VARIANT&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;DECLARE @outputValue sql_variant;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;EXEC [wm].[sp_GetStudentDoB]&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @SchemaName = 'dbo',&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @TableName = 'tblStudents',&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @returnType = 'date', --BigInt&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @outputValue = @outputValue OUTPUT;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;SELECT CONVERT(DATETIME, @outputValue) AS NewDate;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Is there any work around for this?&lt;/P&gt;&lt;P class=""&gt;Any suggestions much appreciated.&lt;/P&gt;&lt;P class=""&gt;Thanks in advance&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Roy&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2025 17:24:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/sql-variant-data-type-in-Lookup-activity/m-p/4762563#M10898</guid>
      <dc:creator>ryand009</dc:creator>
      <dc:date>2025-07-14T17:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: sql_variant data type in Lookup activity</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/sql-variant-data-type-in-Lookup-activity/m-p/4763196#M10919</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/450914"&gt;@ryand009&lt;/a&gt;&amp;nbsp;, Thank you for reaching out to the Microsoft Community Forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Microsoft Fabric doesn't support the sql_variant data type in pipeline activities like Lookup. When your stored procedure returns a sql_variant as an output parameter, Fabric fails to interpret it since it expects outputs to have a clearly defined, supported SQL type, like datetime, bigint, varchar, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To work around this, you need to introduce a wrapper stored procedure. The wrapper should call your original procedure and explicitly convert the sql_variant output to a supported type before returning it. Instead of returning the value as an output parameter, the wrapper should return the final result using a SELECT statement. This way, Fabric can read the output as a standard, well-defined scalar value, which will work smoothly in your Lookup activity.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have control over the original stored procedure, the better long-term solution would be to avoid using sql_variant altogether and return the result directly with a SELECT, already cast to the appropriate type.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-factory/tutorial-preprocess-data-with-stored-procedure-load-into-lakehouse" target="_blank"&gt;Preprocess data with a stored procedure before loading into Lakehouse - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2025 07:20:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/sql-variant-data-type-in-Lookup-activity/m-p/4763196#M10919</guid>
      <dc:creator>v-hashadapu</dc:creator>
      <dc:date>2025-07-15T07:20:20Z</dc:date>
    </item>
  </channel>
</rss>

