I want to run a query similar to this in the 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, executing this result results in an error message:
Duplicate parameter names are not allowed. [Parameter Name = @Param]
The workaround is, of course, defining @Param1and @Param2assigning them the same value, but for me it is a little dirty. Is there a more difficult solution to this problem?
source
share