How can we help you today? How can we help you today?

Exporting bit values as "True" and "False" in Excel

Hello,

I have the following result table : 

Status
1
0

If I were to export that in Excel via the "Open in Excel" context menu, my values are converted to "True" and "False" respectively for 1 and 0. Is there a way to preserve those values as 0 and 1?

This is on SQL Server 11. SQL Prompt is at version 9.1.2.4363.
Felix Rodriguez
0

Comments

3 comments

  • FabiolaB
    Hi frodriguez,

    What type is your Status column? Is it an INT or a BIT?
    You can try casting your Status column to INT. When you open this result in Excel, the values won't get converted. eg Select Cast(Status as int) from yourTable; I hope this helps, Fabiola


    FabiolaB
    0
  • frodriguez
    Thanks, it is a BIT.

    I noticed something similar for NULL. The NULLs get converted to blanks. 
    frodriguez
    0
  • BT

    Please adjust to upper case ‘TRUE’ and ‘FALSE’. Excel does not regard ‘True’ and ‘False’ as native boolean values (e.g. in a comparison formula) without re-editing the data manually.

    BT
    0

Add comment

Please sign in to leave a comment.