这是我的Sql查询:
Update Accounting.ACNT.Book
Set [No] = Case When A.IsAccType10 = 1 Then [No] - 5000000000 Else [No] + 4000000000 End,
FullNo = Stuff(Stuff(FullNo, Len(FullNo) - 10, 2, '05'), 1, Len(FullNo) - 12, '????')
From @Temp A,
[Master].dbo.ParentIDMap B
Where A.BookID = Book.ID And
B.AccType = Cast(SubString(Book.OriginalAccNo, 2, 1) as Int) - 100 And
B.BranchID = Book.BranchID
我可以使用select语句而不是'?????'
作为Stuff
函数的最后一个参数吗?
我需要替换的查询是:
Select ParentFullNo
From [Master].dbo.ParentIDMap A
Where A.BranchID = Book.BranchID
答案 0 :(得分:1)
是的,只需将查询放在括号()
中。