本文介绍了创建一个临时表以在其上进行左外部联接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个查询,现在需要创建一个临时表.它将包含以下字段.我以为我记得如何完成此任务,但是它没有运行.如果我注释掉"IF"和""INTO"行.
如果OBJECT_ID(' tempdb ..#lstLeft')不是空的删除表#lstLeft
I created a query and now need to create a temporary table. It will contain the below fields. I thought I remembered how to complete this task but it doesn''t run. The Query runs fine if I comment out the "IF" & "INTO" lines.
IF OBJECT_ID ('tempdb..#lstLeft') is not null drop table #lstLeft
SELECT
SStaff.StaffName,
PatientProviders.ProviderRole,
SPatient.PatientName,
Immunization.ImmunizationDateTime,
Team.ServiceSection,
Immunization.VisitDateTime,
SPatient.PhoneResidence,
SPatient.PhoneWork,
SPatient.DateOfBirth,
SPatient.Age,
SPatient.Gender,
SPatient.PatientSID
INTO #lstLeft
FROM /* the table and fields work fine in the query not trying to create a tempdb */
推荐答案
这篇关于创建一个临时表以在其上进行左外部联接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!