我刚刚使用兼容模式90将我的SQL Server数据库从2000升级到2005,现在我发现我有一些使用非ANSI连接运算符的查询,这些运算符在SQL Server 2005中并不完全支持。所以我需要将以下代码转换为符合ANSI标准的表单。
FROM gaf (nolock),
gaf_dress as D (nolock index = pkgaf_DRESS_GUM),
gaf_dress as M (nolock index = pkgaf_DRESS_GUM),
mobile (nolock index = pkmobileID),
Quest (nolock index = pkQuestID)
WHERE
gaf.ID = mobile.ID
and gaf.DRESS_GUM_1 *= D.DRESS_GUM
and gaf.DRESS_GUM_2 *= M.DRESS_GUM
and gaf.ID *= Quest.ID
and gaf.RECORD=1
and na2.PURPOSE <> 'Doore'
and gaf.PD_THRU > dateadd(dd, -1, dateadd(mm, -13, convert(datetime, convert(varchar(6),
getdate(), 112) + '01')))
任何帮助都将受到高度赞赏。
我之前试过这个
FROM Name (nolock)inner join mobile
on Name.ID = Demographics.ID left outer join NA1
on Name.ADDRESS_NUM_1 = NA1.ADDRESS_NUM left outer join NA2
on Name.ADDRESS_NUM_2 = NA2.ADDRESS_NUM left outer join ACSW
on Name.ID = ACSW.ID
;with Name_Address (nolock,(index(pkName_AddressADDRESS_NUM)))as NA1
;with Name_Address (nolock, (index(pkName_AddressADDRESS_NUM))as NA2 ;with mobile(nolock,
(index (pkmobileID))
;with ACSW (nolock, (index (pkACSWID)))
WHERE gaf.MEMBER_RECORD=1
and na2.PURPOSE <> 'MAIN'
and gaf.PAID_THRU > dateadd(dd, -1, dateadd(mm, -13, convert(datetime,
convert(varchar(6), getdate(), 112) + '01')))
但它给我这个错误“Msg 102,Level 15,State 1,Line 302 '('。“
附近的语法不正确答案 0 :(得分:4)
FROM gaf
INNER JOIN mobile ON gaf.ID = mobile.ID
LEFT JOIN gaf_dress as D ON and gaf.DRESS_GUM_1 = D.DRESS_GUM
LEFT JOIN gaf_dress as M ON gaf.DRESS_GUM_2 = M.DRESS_GUM AND M.PURPOSE <> 'Doore'
LEFT JOIN Quest ON gaf.ID = Quest.ID
WHERE gaf.RECORD=1
AND gaf.PD_THRU > dateadd(dd, -1, dateadd(mm, -13, convert(datetime, convert(varchar(6),
getdate(), 112) + '01')))