I want to run a query similar to this one on a SqlCE database:
SELECT t.Field1, t.Field2
FROM MyTable t
WHERE t.Field1 = @Param
UNION ALL
SELECT t2.Field1, t2.Field2
FROM MyOtherTable t2
WHERE t2.Field1 = @Param
However, running this results in the error message:
Duplicated parameter names are not allowed. [ Parameter name = @Param ]
A workaround is of course to define @Param1
and @Param2
and assign them the same value, but this feels a bit dirty to me. Is there a cleaner workaround for this problem?