The format causes Excel to import SQL exception resolution _MSSQL

Source: Internet
Author: User

Originally the program is running normally, sometimes because the user's Excel document does not follow the required format to do, will appear some unusual situation. Thought this is the same, and then get the data a look, and did not find anything unusual, and I did some data, unexpectedly also will appear abnormal, had to suspect that their own procedures have problems.

It's really good to talk about the best and find the last mistake. I almost used all the tools I had, and there was really no way to find out what was wrong with the procedure. In a problem for a long time, waste a moment not to say, but also easy to let their emotions down. Later, or turn to doubt the user's data have problems, inadvertently did a bit of formatting adjustment, unexpectedly found abnormal disappeared.

Excel has a rich set of cell formatting, and once the data is formatted, you may not see it. For example, in currency format, the data itself is just a string of numbers and does not contain a currency symbol.

In my program, a column of data is encoded, may be a combination of letters and numbers, but also may be pure numbers, normally, should be formatted as text, probably because pure numbers in this case will have a false hint, that is, the cell next to a yellow exclamation point, the user probably feel wrong, is set to the special format of the ZIP code, the data does not seem to change, but the program in the recognition of the exception occurred. There is another field is the month, the program requires a number before the 0, if the format is set to a number, the previous 0 is not, so must be set to text. If the customization is: 00, although the numbers displayed in Excel are the same as the one you want, the program will be processed as a digital processing and the results will not meet the requirements.

To sum up, for Excel data to be imported into the database, do not format, keep the original character or number format is the most sensible choice.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.