Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Sql row error
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

3 Posts

Posted - 09/17/2013 :  03:44:15  Show Profile  Reply with Quote
I have a .net application which copies data from excel file to sql table. WHile uploading data, I got an error message in my app and while checking the table, I found the following:

I have a column name empid in the sqltable which will be null after uploading. but one row in the table showning blank instead of null
to know the length of the field, I update the null values to blank.
Now I find the length using len function in sql. To My surprise, all fields showing 0 length except one field which is showing 2.
For this reason I am getting an error as the field is not blank. But there is nothing written in the particular field. So, can you help me to trace that problem and it's solution.

with regards,

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 09/17/2013 :  08:39:21  Show Profile  Reply with Quote
See what is in that row using a query like this:
SELECT * FROM YourTable WHERE LEN(empid) > 1
Once you find that row, see what is in the empid column. If it is a non-printing character, see what it is by casting it to varbinary.
Look up ASCII key codes to see what those characters are:
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000