I need to have a sqldatasource with the following sql in it.
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
where @dep is something like (2,3)
However when I try to test the query I get an error saying incorrect syntax near @dep.
Any ideas how I need to write this inside of the datasource in order for it to work?
Thanks,