日期:2014-05-19  浏览次数:20359 次

帮忙看一下
SELECT   HardwareType,Model,[ID],KB_NetAssets.Mac,[Name],[User],Department,StrategyGroup,Location,AlertManageType,Brand,Provider  
FROM     KB_NetAssets   INNER   JOIN     KB_NetAsset_RealtimePCEquipments   ON   KB_NetAssets   .Mac=KB_NetAsset_RealtimePCEquipments   .Mac  
With   NOLOCK  
WHERE   (KB_NetAsset_RealtimePCEquipments.HardwareType= 'IP '  
OR   KB_NetAsset_RealtimePCEquipments.HardwareType= 'HostName '
OR   KB_NetAsset_RealtimePCEquipments.HardwareType= 'HostUser ')
AND   KB_NetAssets.Status!=0  

ORDER   BY   KB_NetAssets.Mac   ,HardwareType  
//////////////////
服务器:   消息   156,级别   15,状态   1,行   5
在关键字   'With '   附近有语法错误。

怎么改呢?

------解决方案--------------------
WITH (NOLOCK)

------解决方案--------------------
SELECT
HardwareType,
Model,
[ID],
KB_NetAssets.Mac,
[Name],
[User],
Department,
StrategyGroup,
Location,
AlertManageType,
Brand,
Provider
FROM
KB_NetAssets WITH(NOLOCK)
INNER JOIN
KB_NetAsset_RealtimePCEquipments WITH(NOLOCK)
ON
KB_NetAssets.Mac=KB_NetAsset_RealtimePCEquipments.Mac
WHERE
(KB_NetAsset_RealtimePCEquipments.HardwareType= 'IP '
OR KB_NetAsset_RealtimePCEquipments.HardwareType= 'HostName '
OR KB_NetAsset_RealtimePCEquipments.HardwareType= 'HostUser ')
AND KB_NetAssets.Status!=0
ORDER BY
KB_NetAssets.Mac ,HardwareType

--try