您好我正在修复特定场景,我有一个通过连接多个表创建的视图,要求是我必须找到该视图中的列是否将返回特殊字符。
SELECT SI.ShipmentId,
CASE
WHEN SA.AddressType = 1 THEN 'SH'
ELSE 'CN'
END AS AddressType,
SI.Pieces,
SI.PalletCount,
SI.Weight,
SI.UserDescription,
SI.Class,
SA.CompanyName,
SA.Street,
SA.City,
SA.State,
SA.ZipCode,
CASE
WHEN SA.Country = 1 THEN 'USA'
WHEN SA.Country = 2 THEN 'CANADA'
END AS Country,
SA.ContactPerson,
Cast(Replace(Replace(Replace(Replace(SA.Phone, ')', ''), '(', ''), '-', ''), ' ', '') AS VARCHAR(25)) AS Phone,
S.PoNo,
S.EstimatedDueDate,
Cast(S.ShipmentReadyTime AS VARCHAR(10)) AS ShipmentReadyTime,
Cast(S.ShipmentCloseTime AS VARCHAR(10)) AS ShipmentCloseTime,
B.BOLNumber,
S.HazMatEmergencyNo
FROM CarrierRate.Shipment AS S
INNER JOIN CarrierRate.BOL AS B
ON B.ShipmentId = S.ID
INNER JOIN CarrierRate.ShipmentItems AS SI
ON SI.ShipmentId = S.ID
INNER JOIN CarrierRate.ShipmentAddresses AS SA
ON SA.ShipmentId = S.ID
INNER JOIN CarrierRate.Carriers AS C
ON C.ID = S.CarrierId
WHERE ( SI.AccessorialId = 1 )
AND ( SA.AddressType IN ( 1, 2 ) )
这就是那个视图,我只是想知道所有列都有特殊字符作为其数据。
对于例如:我有SA.CompanyName
作为列之一,我必须检查该列是否可以填充特殊字符?
请让我知道可能的解决方案,我一无所知。
答案 0 :(得分:1)
您需要查看对您感兴趣的视图列有贡献的表/列/表达式的列类型。假设它们被定义为某种形式的text
或varchar
然后它们可以包含特殊字符,除非在这些列/表上存在某种形式的约束。