我需要一个包含以下 sql 的 sqldatasource。
if @filter = 'departments'
begin
SELECT ISNULL(DocTitle,'') as Name, DocNumber as id, DocUrl+DocName AS link,LastModBy,LastModDate, IsLink
FROM cmc.CMC_Docs d
INNER JOIN CMC.CMC_Doc_Locations as l on l.FamilyID = d.FamilyID
INNER JOIN CMC.CMC_DocFamilies df on df.FamilyID = d.FamilyId
WHERE IsEnabled=1
AND ISNULL(DocName,'') <> ''
AND d.FamilyID IN @dep
ORDER by DocTitle
end
其中@dep 类似于 (2,3)
但是,当我尝试测试查询时,我收到一个错误,提示 @dep 附近的语法不正确。
任何想法我需要如何在数据源中编写它才能使其工作?
谢谢,