我的数据库中有一个名为type_first
的表类型变量。
我需要将此类型作为输入参数传递给我的存储过程,然后从中删除一些记录,然后将type_first
作为输出传递。
我的代码是这样的:
create procedure dbo._sp_checkId
@value dbo.type_first readonly
as
delete from @value
where Id in (select Id
from dbo.tbl_first)
我需要在删除后输出@value
,但我不被允许,因为变量名在查询中必须是唯一的。
我不想在我的数据库中声明另一个类型来插入我的结果,然后在我的存储过程中将其声明为输出。
还有其他建议吗?
答案 0 :(得分:0)
不会......
create procedure dbo._sp_checkId
@value dbo.type_first readonly
AS
begin
delete from @value
where Id in (select Id
from dbo.tbl_first)
--This will return your output when you execute the procedure
Select * from @value
end
GO
GRANT EXECUTE ON dbo._sp_checkId TO public
GO
exec dbo._sp_checkId
答案 1 :(得分:-1)
尝试使用最后的SELECT语句
<DataGrid Name="gvHistory" Grid.Column="0" Grid.Row="9" Margin="2" Visibility="Visible" ItemsSource="{Binding Audits}" Grid.ColumnSpan="8" IsReadOnly="True" Grid.RowSpan="2" AutoGenerateColumns="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CanUserAddRows="False"/>