我有四张桌子:
我想选择DistrictsName =' District1'和PurposeName ='住宅'
我尝试了这个程序:
alter PROCEDURE GetProjects
@districtName nvarchar(50),
@purposeName nvarchar(50)
as
SELECT
p.ID, p.ProjectName, p.Areas,
p.PaymentSystem, p.ReceivedDate,
p.PropertyClassification,
p.ProjectImage,
dis.DistrictName,
Pur.PurposeName
FROM
dbo.Projects AS p
LEFT JOIN
dbo.Districts dis ON p.DistrictID = dis.ID
LEFT JOIN
dbo.Purpose pur ON p.PurposeID = pur.ID
WHERE
(dis.DistrictName = @districtName)
AND (Pur.PurposeName = @purposeName)
exec GetProjects @districtName='District1', @purposeName='residential '
当我执行此过程时,它返回null - 不返回任何数据。
注意:数据库支持的阿拉伯语
当我执行此查询时,它返回结果我认为没有返回数据,因为阿拉伯语
SELECT
p.ID, p.ProjectName, p.Areas,
p.PaymentSystem, p.ReceivedDate,
p.PropertyClassification,
p.ProjectImage,
dis.DistrictName,
Pur.PurposeName
FROM
dbo.Projects AS p
LEFT JOIN
dbo.Districts dis ON p.DistrictID = dis.ID
LEFT JOIN
dbo.Purpose pur ON p.PurposeID = pur.ID
WHERE
(dis.DistrictName = N'arabic value')
AND (Pur.PurposeName = N'arabic value')
答案 0 :(得分:1)
使用此执行命令
exec GetProjects @districtName=N'arabic value',@purposeName=N'arabic value'
将N放在前面以表示您正在使用Unicode。