我不确定为什么会发生这种情况......实际表有数据但是当试图从实际表中提取数据到临时表时,没有数据......
IF object_id('DI_Temp.di.Holly') IS NOT NULL
DROP TABLE DI_Temp.di.Holly
CREATE TABLE DI_Temp.di.Holly
(
Toys varchar(20)
,Meals varchar(100)
,Breaks varchar(20)
)
Insert DI_Temp.DI.Holly
Select
Toys, Meals, Breaks
from toysarefun.dbo.crazytoys (nolock)
where status = 'active'
--Select * from di_temp.di.holly
IF OBJECT_ID('tempdb.dbo.#Toys') IS NOT NULL
DROP TABLE tempdb.dbo.#Toys
SELECT *
INTO #Toys
FROM DI_Temp.di.Holly (NOLOCK)
WHERE Toys like 'H*'
Select *
from tempdb.dbo.#Toys
谢谢 :)