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.
Microsoft SQL Server 2008Microsoft SQL ServerMicrosoft Development
8/22/2022 - Mon
Your help has saved me hundreds of hours of internet surfing.