Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Problem with parameters?

Author  Topic 

yoavb
Starting Member

4 Posts

Posted - 2004-12-06 : 01:13:46
Hello,

The following query:

SELECT SUM(CASE WHEN MyColumn = @p0 THEN 1 ELSE 0 END) AS c0
FROM MyTable

returns an error message "Syntax error or access violation". Why?

TIA

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-12-06 : 01:38:04
can't see any problem with the syntax, it must be access violation then.

do you have permission to read the table, what's the value of @pO, is it compatible with myColumn?

--------------------
keeping it simple...
Go to Top of Page

yoavb
Starting Member

4 Posts

Posted - 2004-12-06 : 01:50:23
The almost identical query:

SELECT SUM(CASE WHEN MyColumn = 0 THEN 1 ELSE 0 END) AS c0
FROM MyTable

Works OK. I'm sending the query from the Data pane of a ReportingServices report in VS.NET 2003, so it should prompt for the parameter value. It doesn't, just complains about this error.

Thanks
Go to Top of Page
   

- Advertisement -