我想插入數據到臨時表中,我使用的是select * into
語法。插入數據到臨時表使用選擇*到
但我得到的錯誤:
Msg 102, Level 15, State 1, Line 8
Incorrect syntax near ')'.
雖然單個查詢獲取執行成功。
代碼:
Create Table #_Total
(
A Int,
B Int,
C Int,
D Int
)
Select * InTo #_Total From(
Select
Sum(Case When Closed=0 And ISNULL(VendorTicketNo,'')='' Then 1 Else 0 End),
Sum(Case When Closed=1 And TicketType<>8 AND ISNULL(VendorTicketNo,'')<>'' Then 1 Else 0 End),
Sum(Case When Closed=1 And CAST(ClosedOn As DATE)= CONVERT(VARCHAR(8),GETDATE(),112) Then 1 Else 0 End),
Sum(Case When Closed=0 And TicketType=8 Then 1 Else 0 End)
From ALBATMStatus.dbo.Ticket
)
Select * From #_Total
數據庫 - SQL SERVER 2008
您不使用Select * INTO的現有表。刪除該表並嘗試再次執行該查詢。或者你需要使用插入語句 – Ankit 2013-02-18 11:28:12
@Ankit:感謝您的信息.. !!! – Shaggy 2013-02-18 11:34:56