• i had to wrap you r example a couple of times to get it to return an empty string instead of null;

    does this help at all?

    declare @id int

    set @id = null

    SELECT ISNULL(NULLIF(convert(varchar(max),Results),'<ID/>'),'') As Val

    FROM

    (

    SELECT Results =(

    SELECT

    CASE WHEN @id is null

    THEN null

    ELSE 'Forehead Barcode' END

    AS [IDType],

    RTRIM(@id) as [Value]

    FOR XML PATH('ID'), TYPE)

    )x

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!