Solved

setting a sql bit field

Posted on 2013-02-07
7
313 Views
Last Modified: 2013-02-13
I have an excel spreadsheet and I am importing it into sql.  One column is True or False,
How do I map it to a column that is of datatype bit?
0
Comment
Question by:Jeff_Kingston
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 15

Expert Comment

by:Aaron Shilo
ID: 38865626
where is the problem just directly map the column .

do you get an error?
0
 

Author Comment

by:Jeff_Kingston
ID: 38865645
No, I just get null in all rows regardless of the true/false value in the imported field.
0
 
LVL 15

Expert Comment

by:Aaron Shilo
ID: 38865729
well i guess the fastest way for you is to load the excell into a STAGE table with column type Nvarchar and then move the data into your permanent table.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 48

Accepted Solution

by:
PortletPaul earned 500 total points
ID: 38866608
1 = true
0 = false

change the column data in Excel perhaps? (i.e. to exclusively 1 or 0, no nulls, and not text 'True' 'False')
0
 
LVL 12

Expert Comment

by:Harish Varghese
ID: 38871678
Hello Jeff,

Ideally, a column of boolean values TRUE/FALSE in Excel should be automatically mapped to bit field when you import into SQL Server table. I tried a sample file and it works fine for me. Would you mind attaching the file here, after removing any sensitive info?

-Harish
0
 

Author Closing Comment

by:Jeff_Kingston
ID: 38885367
Worked like a dream.  Thanks
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 38885422
excellent. have fun.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
backup and restore 21 30
SQL Dump exec output to table 3 23
SQL View / Qtry 3 12
Get rid of the last Last comma and space in a SQL statement. 7 19
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how the fundamental information of how to create a table.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question