> public static void Test_EXP_0071TAttached() > { > using (var context = new PluczExp_PluczContext(Config.model.SqlServer)) > { > var sql = "dbo.Exp_0071TAttached"; > var attached = context.Database.SqlQuery<string>(sql).ToString(); > Console.WriteLine($"EXP_0071TAttached returns {attached}"); > } > } >>
>USE [Exp_Plucz] >GO >SET ANSI_NULLS ON >GO >SET QUOTED_IDENTIFIER ON >GO >ALTER FUNCTION [dbo].[Exp_0071TAttached]() >RETURNS int >AS >begin > declare @result bit = 0 > select @result = CAST( > CASE WHEN DB_Id('EXP_0071T') is not null THEN 1 > ELSE 0 > END > AS BIT) > RETURN @RESULT >END >You declared that the function returns integer but you return bit instead.