Solved

setting a sql bit field

Posted on 2013-02-07
7
311 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
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

In this article I will describe the Backup & Restore 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.
Configuring network clients can be a chore, especially if there are a large number of them or a lot of itinerant users.  DHCP dynamically manages this process, much to the relief of users and administrators alike!
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

920 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