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 6134903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:24:50+00:00 2026-05-23T17:24:50+00:00

I have imported a csv file containing spatial area information in varchar, then converted

  • 0

I have imported a csv file containing spatial area information in varchar, then converted varchar(max) values to varbinary(max) by adding ‘0x’ to varchar(max) values prior to conversion. By then, apart from the ‘0x’ in the beginning, the data in varbinary(max) column looks exactly the same as the varchar(max) one in converted to text.

Now I run the following script:

select geometry::STGeomCollFromWKB(wkb, 4326) from dbo.MyTable

where WKB is the varbinary(max) column.
Running the above script throws this error: ‘The well-known binary (WKB) input is not valid‘

The source of data is from Open Street Map so no doubt they are correct area data. So I assume there must be something wrong in what I am doing or I am missing some point to convert WKB to geometry data type.

Could anyone help please?

  • 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-05-23T17:24:51+00:00Added an answer on May 23, 2026 at 5:24 pm

    I assume the problem is when converting the varchar data to varbinary you are converting the actual character representation of the binary data, rather than just changing the type to binary.

    Eg, if you have the data 0xDEADBEEF in your varchar column, then doing
    convert(varbinary(max), ‘DEADBEEF’) will convert the ascii character representations into binary.

    What you want to do instead is convert the hex string into binary, which is possible using the style parameter of convert.

    SELECT convert(varbinary(max), ‘DEADBEEF’, 2)

    should do what you want to convert your varchar wkb data into real binary.

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

Sidebar

Related Questions

I have my CSV file imported as such: records = FasterCSV.read(path, :headers => true,
I have a table with 600+ columns imported from a CSV file with special
I have a very large CSV file that I imported into a sqlite table.
I have a MySQL table that I have imported from a CSV file. In
So I have already imported one XML-ish file with 3000 elements and parsed them
I have a csv file that has a date field in a format like
I have a large CSV file, approx 10 MB in size, which contains all
hai guys, I have imported my gmail contacts from gmail and a file name
So I have a CSV that contains a filename and a file's contents. The
I have this XML file that I have imported into Cocoa and want to

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.