0

I have created a sql server script of a large database table (more than 2 GB). while running the script I got this error: "Unclosed quotation mark after the character string." While trying to debug the issue I have found that there is a strange "NUL" value between text. This "NUL" is only visible in Notepad++.

Anyone knows how to make script of database table without this "NUL". {If I remove this manually script works fine. But I am not able to remove it manually as some tables are more than 10 GB}

enter image description here

Thanks

6
  • How did you generate this script? Commented Nov 16, 2015 at 11:32
  • Using SQL Server. Tasks=>Generate Scripts Commented Nov 16, 2015 at 11:33
  • I guess your data contains NUL literal: stackoverflow.com/questions/2828333/…. Check for one column with it SELECT col_name, LEN(col_name) , DATA_LENGTH(col_name) FROM table WHERE id = ? Commented Nov 16, 2015 at 11:35
  • Any Idea to resolve this issue? Commented Nov 16, 2015 at 11:36
  • Probably you will need to clean your data. Or use replace in Notepad++ NUL to empty Commented Nov 16, 2015 at 11:37

1 Answer 1

1

Thanks all I have solved my issue.

I was reading data from NON MS Sql Database and inserting into MS SQL server using asp .net ADO way. During testing of the cause I found that there is invalid data "NUL" in the existing database. So I modified my insertion code and just replaced "NUL" with "Blank" using REGEX.

Regex.Replace(MyDataColumnName, "\x00", "", RegexOptions.IgnoreCase); 

Now there is no "NUL".

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.