.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

(On SELECT) Hexadecimal value 0x19 is an invalid character

Posted By:      Posted Date: October 28, 2010    Points: 0   Category :Sql Server

Hi everyone,

I'm using SQL Server 2008 Management Studio and trying to select from a sql table that has an invalid XML character in it.


If I just try to select * from the table I get:

An error occurred while executing batch. Error message is: '(square box)', hexadecimal value 0x19, is an invalid character.

I've tried to run a select replace(DataXML, char(25), ') from the table as suggested in this thread:



and I get the error message:

Argument data type xml is invalid for argument 1 of replace function.


Converting the column type in the table doesn't work. Cast doesn't work. Everything I've tried gives an error.

I just want to get rid of the invalid character and take a look at what's inside the XML so I can try to prevent this from happening again.


Anyone have any ideas?

View Complete Post

More Related Resource Links

XML Task error message hexadecimal invalid character

I am developing a SSIS package to add data from an XML file to an existing SQL Server table.  I have completed several similar projects, but on this XML file I am getting the error from the Data Flow tab between the XML Task and Data Flow Task: Error: 0xC002F304 at XML Task, XML Task: An error occurred with the following error message: "'', hexadecimal value 0x15, is an invalid character. Line 28, position 54.". Error: 0xC002928F at XML Task, XML Task: Property "New Source" has no source Xml text; Xml Text is either invalid, null or empty string. Task failed: XML Task Warning: 0x80019002 at zSTU_TS_Element: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (2) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors. SSIS package "zStu_TS_Element.dtsx" finished: Failure. Do you know how I can fix this? This is the line it is referring to: <z:row c0='12' c1='80' c2='2006-04-17' c3='539' c4='1M2083N4N5N6N75800901110 11 '/>

XmlWriter.WriteRaw - hexadecimal value 0x1F, is an invalid character.

Using VS 2008, .Net 3.5, C#. In creating an XML string, I need to embed some non-printing ASCII characters such as 0x1C, 0x1D, 0x1E and 0x1F. However, when writing them using the WriteRaw function, I get the error message "hexadecimal value 0x1F, is an invalid character". In checking XML specifications, all the characters I am using are valid in XML. The xml declaration in the string is "<?xml version="1.0" encoding="utf-16"?>" Thanks in advance for any guidance.  

IIS 5.1 '.', hexadecimal value 0x00, is an invalid character



I have a  web page which calls some XML from a web service.  The code works fine on my production server (IIS 7) but I get the below error on my Development machine Win XP, IIS 5.1

'.', hexadecimal value 0x00, is an invalid character

Any ideas why I am getting this error when on IIS 5.1

Many thanks in advance


The site master page setting currently applied to this site is invalid. Please select a new master p

I have defined a new master page and set it as default for the main site.  Any time I create a new subsite it does not apply the new master page and defaults back to the default.master.  The Site Master Page Settings shows this error. The site master page setting currently applied to this site is invalid. Please select a new master page and apply it The system master page setting currently applied to this site is invalid. Please select a new master page and apply it. Now if I select "Inherit site master page from parent of this site" and "Inherit system master page" and click ok the site will use the new master page and everything is fine.  There is only one modification to the master page that was done so I know the master page isn't invalid.  Does anyone know the answer other than recreating the new master page.

Cannot FindByThumbprint - Invalid Hexadecimal string format

I'm trying to set up a sample WCF service using a self-signed certificate.  For some reason, I repeatedly get the error "FormatException - Invalid hexadecimal string format." I was initially trying it in the config file but decided to try setting it up in code but still get the same error. I then tried it on a different machine and it works just fine.  I would appreciate any suggestions.  Here are the details. Environment:  Windows 7 Home Premium, Visual Studio 2010 C# Express Edition, .NET 4.0 Code:     // Create the host ServiceHost host = new ServiceHost(hostType);     string valueToFind = "‎‎‎‎‎66 31 bf 9e f7 4f 9e b6 c9 d5 a6 0c ba 6a be d1 f7 bd ef 7b"; host.Credentials.ServiceCertificate.SetCertificate(   StoreLocation.CurrentUser, StoreName.Root, X509FindType.FindByThumbprint, valueToFind);     The exact same code runs just fine on another machine.  No complaints of an invalid hexadecimal value.  Here are the details of the other machine: Environment:  Windows XP, Visual Studio 2010 C# Premium, .NET 4.0 Any ideas?

How do I escape invalid xml character 0x02?

In one of my tables an end user managed to insert a character 0x02 into a varchar(255) column. At some point in time, from this table xml documents are generated using the for xml path() syntax. For the record with the 0x02 character in it this now generates an error:

".Net SqlClient Data Provider: Msg 6841, Level 16, State 1, Line 22
FOR XML could not serialize the data for node 'v' because it contains a character (0x0002) which is not allowed in XML. To retrieve this data using FOR XML, convert it to binary, varbinary or image data type and use the BINARY BASE64 directive."

I've now  hit this error on char(2), but the same error occurs for a lot more characters.

The example below illustrates this by inserting 2 records in a table and creating an xml document for both records. The record with id = 1 is no problem, a valid xml is generated; even the '&' in it is properly escaped in the xml and translated back into a '&' when I retrieve the varchar value for the element. The record with id = 2 can however not be generated into an xml document.

I would expect an escape sequence like '&#02;' to be generated for the char(2) character, analogous like the '&' is escaped as '&amp;'.

select 15 words(not character) from table


i want to select only 15 words from table  , plz reply me how can i do this???

SQLCMD results in a hexadecimal value for a SELECT FORXML AUTO

I have a stored procedure, that uses FORXML AUTO to reutrn an XML document.
When I call it from SQLCMD, it results in a hexadecimal value (0x....) instead of an XML text.
When I used to call it from OSQL, it resulted in a correct XML text.
When I call it from SQL Mgmt Studi or Query Analyser, the reult is also correct, an XML text.

The way I call SQLCMD is:
sqlcmd -E -S"SQLCLU01\INST01" -d"SFA" -Q"exec ReportGetDataAsXML 6760910"

The result is:

Any suggestions?

Web service's method GetListItems fails with error "'_', hexadecimal value 0x0B, is an invalid ch


We are developing ASP.NET web application that interacts with SharePoint via web services. At some our customers' systems we encountered the following problem.
Web method GetListItems throws an exception :
 ' ', hexadecimal value 0x0B, is an invalid character. Line 42, position 31.

Stack trace of exception you can see below:
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at ITSMS.DAL.SPLists.Lists.GetListItems(String listName, String viewName, XmlNode query, XmlNode viewFields, String rowLimit, XmlNode queryOptions, String webID)

INNER MESSAGE: ' ', hexadecimal value 0x0B, is an invalid character. Line 42, position 31.

   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(St

When opening the Reports site, I get "A name was started with an invalid character." error


Hello, I am running out of ideas on how to get SSRS to work.  I am trying get this setup with the intention to replace our Crystal Reports server.  Currently I have set up the RS Virtual Directory on a Win XP box.  The ReportServer database sits on another SQL2000 box. 

I can connect to the http://localhost/ReportServer/ on the XP box to display the page the depicts "Microsoft SQL Server Reporting Services Version 9.00.2047.00"  

When I connect to the http://localhost/Reports/, I get this error "A name was started with an invalid character. Error processing resource 'http://leej/Reports/'. Line 1, Position 2"   I checked my IIS Virtual Directory properties for Reports and ASP.NET is set to v2.0.50727.   I also executed "aspnet_regiis.exe -i" in the "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727" directory.  

Any thought on how to fix this?  I hate to let this blocker deters us from deploying SSRS.



invalid character whil running the open xml script

hi i am facing problem while running the following sql statement

 SET NOCOUNT ON DECLARE @hDoc INT EXEC sp_xml_preparedocument @hDoc OUTPUT, '<NewDataSet> <Forms Layout=''&lt;StackPanel Background=&quot;#FFFFFFFF&quot; Name=&quot;StackPanelUser&quot; Width=&quot;1001&quot; Height=&quot;600&quot; Margin=&quot;10,5,10,5&quot; HorizontalAlignment=&quot;Center&quot; ClipToBounds=&quot;True&quot; twcdd:RadDragAndDropManager.AllowDrop=&quot;True&quot; xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; xmlns:iedf=&quot;clr-namespace:Iris.Ews.Designer.Form;assembly=Iris.Ews.Designer.Form&quot; xmlns:twcdd=&quot;clr-namespace:Telerik.Windows.Controls.DragDrop;assembly=Telerik.Windows.Controls&quot;&gt;&#xD;&#xA; &lt;ScrollViewer HorizontalScrollBarVisibility=&quot;Auto&quot; VerticalScrollBarVisibilit

SQL sp_xml_preparedocument - XML parsing error: An Invalid character was found in text content


SQL sp_xml_preparedocument - XML parsing error: An Invalid character was found in text content

I am sending an xml document to Sql Server as text and this error occurs only when sp_xml_preparedocument is called with special characters(öß) in the xml.

 I am using OPENXML to extract the data from the elements to store in tables, however SQL Servers sp_xml_preparedocument cause an exception with special characters.

As a temp fix,
I solved this issue by changeing the sql stored procedure parameter that accepts the XML document to ntext type and changed the table columns type to nvarchar. This allowed the special characters to be inserted without errors into SQL

Required Solution
Do i have any other solution to stayback with my text and varchar datatype rather than using ntext and nvarchar?

http://www.selvaonline.com - Live a Happy & Balanced Life

Unable to select from XML column - illegal character


I have a database with an XML column.  During the course of normal operations, a record was inserted into this table which completed successfully.  However, when we run a report on this table and attempt to select the data back out of that column, we receive the following error:

From the a stored procedure -

Msg 6611, Level 16, State 1, Procedure shrrptAuditReport, Line 19

The XML data type is damaged.

From a select against the table -

An error occurred while executing batch. Error message is: '?', hexadecimal value 0xDC29, is an invalid character. (NOTE: The ? actually appears as a square in SSMS)

AJAX GridView Checkbox Select All in ASP.Net

In the previous article GridView Select Multiple Rows you learnt the multiple row selection in GridView control. Here you will get the C# code sample to select all the gridview rows using single checkbox server control. You can highlight the selected rows with different color and Font state Bold. If you want to use the selection values on different ASP.Net

Select value in gridview


Hi, I am new to gridview. I want to make a gridview. Its row when selected should direct me to a specific .aspx page.Each row should direct to a different page. Should I use querystrings for this? Please suggest. Regards, ap.

WebMatrix conversion failed when converting from a character string to uniqueidentifier?


I am trying to retrieve xml from a small function in my .cshtml page. Its throwing me an error. This however, runs fine in a console/form environment.

It takes 3 parameters and 1 exception.

myDll.GetXML(year, username, uniqueidentifier, out ex);

When I run this page I get the error, "Conversion failed when converting from a character string to uniqueidentifier."

Or a stack of.

System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting from a character string to uniqueidentifier.

   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()

   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()

   at System.Data.SqlClient.SqlDataReader.get_MetaData()

   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBeha

Web Deployment Projects (WDP) arabic character



I built web project using asp.net & c# in VS2005 and i use arabic label in my project and every think working good when i run my application. but when i use WDP to make msi file All arabic letter come like ?????. 


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend