代码:
SELECT
[ADO NET Destination].Vendor_ID,
[ADO NET Destination].Vendor,
[ADO NET Destination].Address1,
[ADO NET Destination].Address2,
[ADO NET Destination].City,
[ADO NET Destination].Zip
FROM
[ADO NET Destination]
WHERE
((([ADO NET Destination].Parish) IN ("Caddo", "Bossier", "DeSoto", "Webster")));
错误:
Msg 207,Level 16,State 1,Line 3
列名称无效' Webster'。Msg 207,Level 16,State 1,Line 3
列名称无效' DeSoto'。Msg 207,Level 16,State 1,Line 3
列名称无效' Bossier'。Msg 207,Level 16,State 1,Line 3
列名称无效' Caddo'。
答案 0 :(得分:6)
字符串在T-SQL中使用单引号:
'Caddo','Bossier','DeSoto','Webster'
答案 1 :(得分:3)
为什么这么多()在哪里和文字的双引号?尝试
SELECT
[ADO NET Destination].Vendor_ID
, [ADO NET Destination].Vendor
, [ADO NET Destination].Address1
, [ADO NET Destination].Address2
, [ADO NET Destination].City
, [ADO NET Destination].Zip
FROM [ADO NET Destination]
WHERE [ADO NET Destination].Parish In ('Caddo','Bossier','DeSoto','Webster');