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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:23:37+00:00 2026-05-27T09:23:37+00:00

Table1 has data to be imported into Table2. Table1 contains only varchar fields, but

  • 0

Table1 has data to be imported into Table2. Table1 contains only varchar fields, but they will be cast to the type of whatever field they are going to be imported into in Table2.

The data has to be imported one row at a time, so I can catch exceptions to find out which rows cause a problem but this doesn’t tell me which column is the culprit and if there are very many exceptions than it’s slower than just checking for valid data ahead of time (not to mention I want the ability to fix problems before starting the import process anyway… preferably without having to actually do a transaction and roll it back just to find out what the issues are).

Ideally, I would like to do something like this:

select RowNumber from table where cast(fieldName as SomeDataType) = 0

Obviously that statement doesn’t make sense because this is not what cast does, but the idea is that I’d like a function that tries to cast the data and returns a true or false value depending on whether the cast was successful.

Is there some easy way to do this that I’ve overlooked?

  • 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-27T09:23:38+00:00Added an answer on May 27, 2026 at 9:23 am

    Related posts:

    MS SQL server casting without exception

    How do I TryParse in SQL 2000?

    You may end up needing to write a user-defined function to that combines a few different methodologies to attempt the cast. Since it’s an import, I’m assuming that performance isn’t the highest concern; calling a UDF will slow down the process.

    You could also try writing a CLR stored procedure and use .NET type checking and conversion to at least broadly categorize your data (exact classification may be difficult due to the differences in types between .NET and T-SQL).

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

Sidebar

Related Questions

My table has a timestamp column named RowVer which LINQ maps to type System.Data.Linq.Binary.
I'm looking into horizontal partitioning for a table that has time-series data in it.
So imagine 2 big mysql tables imported from Excel. Table1 has the field SNameID,
I have a table with 20,000 rows of data that I imported but I
I have an Excel file (which has data imported from Oracle 10G Database) one
I have data imported from an excel sheet into a table in db. Now
Suppose I have one table table1 and another table table2. Both has same column
I recently imported about 60k records into a table that relates data in one
My table has data like so products_parent_id | products_quantity 2 5 2 7 2
I have a table that has redundant data and I'm trying to identify all

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.