troubleshooting Question

quotes in SQL Statement

Avatar of ITMikeK
ITMikeKFlag for United States of America asked on
Microsoft SQL ServerMicrosoft DevelopmentMicrosoft SQL Server 2008
12 Comments1 Solution558 ViewsLast Modified:
I have a select statement in a SP in an SQL 2008 database that contains the following:

SUM(case when b.TrxType = 'R' AND b.LbsTransferred =  0 then b.NoOfCoils else 0 end) As Received

If I have this outside the stored procedure, it works fine...but inside the procedure it states that there is incorrect syntax near 'R'.
If I change the 'R' to ' 'R' ' the error goes away , but the procedure does not return the value of R.

Any ideas?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 12 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros