SQL 提示必须声明表变量
USE[idlist]GOSETANSI_NULLSONGOSETQUOTED_IDENTIFIERONGOALTERPROCEDURE[dbo].[ccout]@lxv...
USE [idlist]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[ccout]
@lx varchar(10),
@id varchar(30),
@zt varchar(10),
@sjbh varchar(10)
AS
begin
set nocount on
declare @sql nvarchar(500)
declare @int int
if @lx='1'
begin
With T
As
(
Select Top 1 * From @id Where 状态=1 Order by newid() '这里出的错误
)
Update T Set 状态=2
Output inserted.编号,inserted.账号,inserted.密码
end
else
begin
set @sql='update '+@id+' set 状态='+@zt+' where 编号='+@sjbh
exec(@sql)
end
set nocount off
end
对存储过程不太了解,在调试运行存储过程时提示必需声明表变量@id,求大神帮忙 展开
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[ccout]
@lx varchar(10),
@id varchar(30),
@zt varchar(10),
@sjbh varchar(10)
AS
begin
set nocount on
declare @sql nvarchar(500)
declare @int int
if @lx='1'
begin
With T
As
(
Select Top 1 * From @id Where 状态=1 Order by newid() '这里出的错误
)
Update T Set 状态=2
Output inserted.编号,inserted.账号,inserted.密码
end
else
begin
set @sql='update '+@id+' set 状态='+@zt+' where 编号='+@sjbh
exec(@sql)
end
set nocount off
end
对存储过程不太了解,在调试运行存储过程时提示必需声明表变量@id,求大神帮忙 展开
2个回答
展开全部
Create PROCEDURE [dbo].[ccout]
@lx varchar(10),
@id varchar(30),
@zt varchar(10),
@sjbh varchar(10)
AS
begin
set nocount on
declare @sql nvarchar(500)
declare @int int
if @lx='1'
begin
Set @sql='
With T
As
(
Select Top 1 * From '+@id+' Where 状态=1 Order by newid()
)
Update T Set 状态=2
Output inserted.编号,inserted.账号,inserted.密码 '
end
else
begin
set @sql='update '+@id+' set 状态='+@zt+' where 编号='+@sjbh
end
exec (@sql)
set nocount off
end
@lx varchar(10),
@id varchar(30),
@zt varchar(10),
@sjbh varchar(10)
AS
begin
set nocount on
declare @sql nvarchar(500)
declare @int int
if @lx='1'
begin
Set @sql='
With T
As
(
Select Top 1 * From '+@id+' Where 状态=1 Order by newid()
)
Update T Set 状态=2
Output inserted.编号,inserted.账号,inserted.密码 '
end
else
begin
set @sql='update '+@id+' set 状态='+@zt+' where 编号='+@sjbh
end
exec (@sql)
set nocount off
end
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询