Click here to Skip to main content
15,905,781 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
One of my database table field insert "&" sign like PIA&R009.when I retrieve the data using select statement its showing PI R009. How can I handle this. Thanks in advance.
Posted
Comments
F-ES Sitecore 12-Nov-15 6:18am    
You'll need to post the relevant code.

1 solution

That depends - I don't have any problem here, but it's possible that it's not SQL at all, but the environment you are displaying the data in.
For a website, HTML uses "&" as a "special character" in the same way that C-like languages use "\" - it introduces a sequence which makes up a single character. So if you are sending the raw "&" character to a client browser, it's likely being "swallowed" there. In that case, replace it with
& amp ;
(without the spaces) and it should be fine.

But start with your database: check the column definition (NVARCHAR should be fine regardless, but VARCHAR may cause a conversion problem as the former is UNICODE and the latter isn't - not likely, but it's worth a look). Then examine the column content and make sure that it genuinely is an "&" character rather than some other Unicode symbol that looks like it in the correct font.
 
Share this answer
 
Comments
Maciej Los 13-Nov-15 2:02am    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900