1
我想運行此查詢,但myfield不包含完整的電子郵件地址,姓氏,電話和電子郵件促銷值?它看起來像myField的長度有限制?選擇結果不完整?
SQL語句:
use adventureworks
go
select si.CustomerID,
'myField' =
CASE
When (Select Top 1 FirstName+ ' ' + MiddleName + ' '+ Phone + ' ' + EmailAddress +' '+ LastName + ' ' + Phone + ' ' + cast(EmailPromotion as varchar) From Person.Contact pc Where si.ContactID = pc.contactid) is not null Then
Cast((Select Top 1 FirstName+ ' ' + MiddleName + ' ' + Phone + ' ' +EmailAddress +' '+ LastName + ' ' + Phone + ' ' + cast(EmailPromotion as varchar) From Person.Contact pc Where si.ContactID = pc.contactid ) As varchar)
Else ''
END
from Sales.Individual si
where si.CustomerID=11000