Solved

setting a sql bit field

Posted on 2013-02-07
7
310 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
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.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

705 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now