Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

Can I use an IIF comparing a variable in an select statement

$
0
0

Hi,

I have a select statement which works well in Access but, I can't seem to get the correct syntax for SQL Server. An error occurs near the '>' . Basically I would like AddressLine2 to receive the variable 'BusinessName'  if it's value is greater than a space or or the literal 'OR CURRENT RESIDENT' if its less. I have a few other comparison type statements as well. What am I doing wrong?

SELECT dbo_membership.seq_num
, dbo_membership.db_key, dbo_membership.FirstName, dbo_membership.LastName
, IIf(dbo_membership.BusinessName>' ',dbo_membership.BusinessName, 'OR CURRENT RESIDENT') AS AddressLine2
, dbo_membership.address, ....
FROM dbo_fsamembership;


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>