JCWEBHOST
asked on
Sql Null
Hey guys, i have a question.
i have an sql query
select DISTINCT UPPER(r_name) as r_name, UPPER(address) as address, area, location, p_code, tel, website, '<b>'+ r_name + '</b>' + '<br>' + address + '<br>' + area + '<br>' + location + '<br> Contact: ' + tel as InfoWindowText, Latitude as Lat, Longitude as Lng FROM dbo.pretoria where active='Yes'
my problem is here
'<b>'+ r_name + '</b>' + '<br>' + address + '<br>' + area + '<br>' + location + '<br> Contact: ' + tel as InfoWindowText
if my location is null it not pulling
so how can i have an if statement in that query so if loction is null it must not add the location and if it is not null add the loction to the nfoWindowText?
i have an sql query
select DISTINCT UPPER(r_name) as r_name, UPPER(address) as address, area, location, p_code, tel, website, '<b>'+ r_name + '</b>' + '<br>' + address + '<br>' + area + '<br>' + location + '<br> Contact: ' + tel as InfoWindowText, Latitude as Lat, Longitude as Lng FROM dbo.pretoria where active='Yes'
my problem is here
'<b>'+ r_name + '</b>' + '<br>' + address + '<br>' + area + '<br>' + location + '<br> Contact: ' + tel as InfoWindowText
if my location is null it not pulling
so how can i have an if statement in that query so if loction is null it must not add the location and if it is not null add the loction to the nfoWindowText?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use ISNULL() function to check whether the location field is null or not. SQL query is pasted below:
Open in new window