You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Microsoft Sql Server, <PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
To Reproduce
SqlConnection connection = .....
await connection.ExecuteAsync(@"
declare @t1 table(id int, val int)
declare @t2 table(id int, val int)
declare @t3 table(resultid int)
insert into @t1(id,val) values(1,1)
insert into @t2(id,val) values(1,20)
update t set
val = 2
output inserted.id into @t3(resultid)
from @t1 t
join @t2 t2 on t.id = t2.id
where t2.val > 10
");
Expected behavior
I expected no warnings, but got three, which at least in my opinion could all be considered false positives:
update t set produced warning DAP225 FROM expressions with multiple elements should use aliases
I didn't get this one in my production code, only in this minimal example, but I did update a regular table not a table variable, maybe that is the difference.
val = 2 produced warning DAP226 FROM expressions with multiple elements should qualify all columns; it is unclear where 'val' is located
This warning could possibly be considered valid, but I don't think it makes sense, because the update t set already specifies, that only columns of t can be updated...
into @t3(resultid) produced warning DAP226 FROM expressions with multiple elements should qualify all columns; it is unclear where 'resultid' is located
This does not make sense, as resultid is not a column of any of the tables in the from clause.
Screenshots
Additional context
I just wanted to mention that I really like the analysers made available by Dapper.AOT, only very few false positives when I switched to AOT and great to find errors in SQL Queries!
The text was updated successfully, but these errors were encountered:
Describe the bug
False positives of the T-Sql Analyser in a
update ... output into ... from
statement, see below.Where are you seeing this?
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="Dapper.AOT" Version="1.0.31" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
To Reproduce
Expected behavior
I expected no warnings, but got three, which at least in my opinion could all be considered false positives:
update t set
produced warning DAP225FROM expressions with multiple elements should use aliases
I didn't get this one in my production code, only in this minimal example, but I did update a regular table not a table variable, maybe that is the difference.
val = 2
produced warning DAP226FROM expressions with multiple elements should qualify all columns; it is unclear where 'val' is located
This warning could possibly be considered valid, but I don't think it makes sense, because the
update t set
already specifies, that only columns oft
can be updated...into @t3(resultid)
produced warning DAP226FROM expressions with multiple elements should qualify all columns; it is unclear where 'resultid' is located
This does not make sense, as
resultid
is not a column of any of the tables in the from clause.Screenshots
Additional context
I just wanted to mention that I really like the analysers made available by Dapper.AOT, only very few false positives when I switched to AOT and great to find errors in SQL Queries!
The text was updated successfully, but these errors were encountered: