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 2005 Forums
 SQL Server Administration (2005)
 Help reqd for getting null values

Author  Topic 

manju_praj
Starting Member

2 Posts

Posted - 2010-01-06 : 15:28:51
How can i get the values even when the Source or url is null from the below query

SELECT a.id,
isnull((SELECT STUFF((SELECT
'<li><a href="'+url+'">'+Source_Name+'</a>
<span class="small">(' + k.Source +')</span></li>' end
FROM table1 i, table2 k, table3 j where
i.CategoryID = j.Category_ID and i.CategoryID = c.Category_ID and i.Source = k.ID
FOR XML PATH('')),1, 0, '')), '') AS Source_url,
FROM @table4 c INNER JOIN table5 v
on c.Category_ID = v.Category_ID

shan
Yak Posting Veteran

84 Posts

Posted - 2010-01-06 : 15:51:25
Can you pls provide more detail.

If you are getting null values from the table you should be able to handle them with isnull function.

-Shan
Go to Top of Page

manju_praj
Starting Member

2 Posts

Posted - 2010-01-06 : 15:56:31
Hi

isnull function is not handling the problem when Source_Name or Source or url is null maybe because it creates an xml form.

I am looking to get all the values inside the below query when url or source is null
((SELECT STUFF((SELECT
'<li><a href="'+url+'">'+Source_Name+'</a>
<span class="small">(' + k.Source +')</span></li>' end
FROM table1 i, table2 k, table3 j where
i.CategoryID = j.Category_ID and i.CategoryID = c.Category_ID and i.Source = k.ID
FOR XML PATH('')),1, 0, '')), '') AS Source_url
Any Suggestions is appreciated.

Thanks
Manju
Go to Top of Page
   

- Advertisement -