0
我在下面的存储过程中有这些错误。Sql存储过程与1声明值,2更新语句和1插入语句
当未通过EXISTS引入 子查询时,只能在选择列表中指定一个表达式。提供的值的列名或编号 与表定义不匹配。
Create PROCEDURE [dbo].[tbl_TeleCom_UpdateTeleComNo]
@type varchar(100) ,
@comNo varchar(100),
@status bit
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
Declare @b_ComNo varchar(100)
Set @b_ComNo = (Select * from tbl_TeleCom where Type = @type)
IF @b_ComNo IS NOT NULL
BEGIN
Insert Into tbl_ComNoHistory
Select B_ComNo, B_StartTime, B_EndTime
from tbl_TeleCom
where Type = @type
Group By B_ComNo, B_StartTime, B_EndTime
END
Update tbl_Balance Set
Status = 0
from tbl_Balance
Join tbl_TeleCom On tbl_TeleCom.CurrentComNo = tbl_Balance.ComNo
And tbl_TeleCom.Type = @type
Update tbl_TeleCom Set
CurrentComNo = @comNo,
CurrentTime = GETDATE(),
B_ComNo = CurrentComNo,
B_StartTime = CurrentTime,
B_EndTime = GETDATE()
where Type [email protected]
Update tbl_Balance Set
Status = @status
from tbl_Balance
Join tbl_TeleCom On tbl_TeleCom.CurrentComNo = tbl_Balance.ComNo
And tbl_TeleCom.Type = @type
END
和whts你这里概率? – user7417866
我有这些错误。 当子查询未与EXISTS一起引入时,只能在选择列表中指定一个表达式。 提供的值的列名或数量与表定义不匹配。 – Erebus
我无法运行这个SQL过程。 – Erebus