Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8265027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:39:14+00:00 2026-06-08T04:39:14+00:00

I have a sql table that gets populated via SQLBulkCopy from Excel. The copy

  • 0

I have a sql table that gets populated via SQLBulkCopy from Excel. The copy down is done using the Microsoft ACE drivers.

I had a problem with one particular file – when it was loaded down to sql, some of the columns (which appear empty in excel) contained an odd value.

For example, running this sql:

SELECT
    CONVERT(VARBINARY(10),MyCol),
    LEN(MyCol)
FROM MyTab

would return

0x, 0

i.e. – converting the value in the column to varbinary shows something, but doing length of the varchar shows no length. I realise that the value shown is the stem of a hex value, but its weird that its gets there, and how hard it is to detect.

Obviously I can just clear out the cells in Excel, but I really need to detect this automatically as end users will have the same issue. It is causing issues further down the line when the data gets processed. Its quite hard to trace the problem back from its eventual symptoms to being this issue in the source.

Other than the above conversion to varbinary to output in SSMS I’ve not come up with a way of detecting these values, either in Excel or via a SQL script to remove them.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:39:15+00:00Added an answer on June 8, 2026 at 4:39 am

    As Martin points out above, 0x is what you get when you convert an empty string. eg:

    SELECT CONVERT(VARBINARY(10),'')
    

    So the problem of detecting it obviously goes away.

    I have to assume that there is some rubbish in the excel cell, that is being filtered out in the process of the write down by either the ACE driver or the SQLBulkCopy. Because there was something in the field originally, the value written is empty instead of null.

    In order to make sure that everything is consistent in the data we’ll need to do a post process to switch all empty values to nulls so that the next lots of scripts work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL Table UDF That gets a Standard Deviation from a 20
I'm using SQL Server 2008 and I have a table that has a 'Status'
We have a table with a Primary Key that gets populated on insert by
I have some SQL that gets a few details about a table. SELECT Column_Name,
I have a Formview that gets populated with SQL data when a dropdown is
I have a table that gets information from my local MySQL server. It reads
I have a SQL table that has a primary key ( Row_id ) that
Hi there I have an SQL table that looks like this: CREATE TABLE IF
I have an SQL Server 2005 table that has a varchar(250) field which contains
I have a SQL Server table in production that has millions of rows, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.