出于某种原因,我对这个陈述有疑问
Insert into TblStuff
(FullName,Address,City,Zip)
Select
Case
When Middle is Null Then Fname + LName as FullName,
Else Fname +' ' + Middle + ' '+ Lname as FullName,
End
Case
When Address2 is Null Then Address1 as Address,
else Address1 +', ' + Address2 as Address,
End
City as City,
Zip as Zip
from tblImport
我在关键字“as”附近收到不正确的语法
编辑添加到这个问题,让我知道是否需要添加新帖子。
我知道下面的陈述有点不同,但你能做一个类似于下面的案例陈述吗?下面的陈述甚至有意义吗?
Insert into TblStuff
(NickName,FirstName,MiddleName,Suffix)
Case when FirstName IS NULL then
NickName as Nickname,
IsNULL(FirstName,'''') as FirstName,
IsNULL(MiddelName,'''') as MiddleName,
IsNULL(NameSuffix,'''') as Suffix,
Else
IsNull(NickName2,'''') as NickName,
IsNULL(FirstName,'''') as FirstName,
IsNULL(MiddelName,'''') as Middlename,
Case when NameSuffix2 is NULL then
IsNULL(NameSuffix,'''')as suffix,
Else
IsNULL(NameSuffix,'''') + '''', '''' + IsNULL(NameSuffix2,'''') as suffix,
End
End
From tblImport