1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

How to print NULL when table has no rows in SQL Server?

Discussão em 'Outras Linguagens' iniciado por Stack, Maio 19, 2021.

  1. Stack

    Stack Membro Participativo

    I have a table with a named column but no rows.

    Col1


    I wanted to write a select similar to:

    SELECT TOP(1)
    NULLIF(Col1, '')
    FROM table


    I wanted to get a result like:

    Col1
    1 NULL


    But instead I get just the Col1 name and no results. How can I get a table with NULL as the result?

    Continue reading...

Compartilhe esta Página