I wonder why the strange ?????? is appearing in the below query result . Really don't know about the root cause of this issue. Can someone please shed light on this problem?
if OBJECT_ID('tempdb..#TB_SPECS') is not null drop table #TB_SPECS
CREATE TABLE #TB_SPECS
(
STRING_VALUE NVARCHAR(MAX)
)
INSERT #TB_SPECS(STRING_VALUE)
VALUES('SingLe heat-treated and fully thru-hardened for toughness, these guards')
select * from #TB_SPECS
Output:-
???????SingLe heat-treated and fully thru-hardened for toughness, these guards
Did you copy this value from somewhere? It looks like there are some non-printable characters that are being recognized that correspond to the '?' characters you are seeing:
Really don't know about the root cause of this issue. Can someone please shed light on this problem?
This is because you are inserting non-unicode string literal into
unicode field. There are some non-unicode characters before "SingLe" as @Rion mentioned.
To solved this problem, you can put an "N" before whatever you want to insert:
if OBJECT_ID('tempdb..#TB_SPECS') is not null drop table #TB_SPECS
CREATE TABLE #TB_SPECS
(
STRING_VALUE NVARCHAR(MAX)
)
INSERT #TB_SPECS(STRING_VALUE)
VALUES(N'SingLe heat-treated and fully thru-hardened for toughness, these guards')
select * from #TB_SPECS
@ Rion Yes I copied the value from an excel sheet.
Thanks for your reply. I overwhelmed to see you answering my question in Microsoft forums, as I have already read plenty of your articles in the CSharpCorner website (Awesome articles).
I must say that something I have learned today. Thanks once again.
Member
34 Points
73 Posts
Strange Question Mart in the Output
Feb 17, 2020 12:52 PM|nagarajasia|LINK
Hi,
I wonder why the strange ?????? is appearing in the below query result . Really don't know about the root cause of this issue. Can someone please shed light on this problem?
Output:-
???????SingLe heat-treated and fully thru-hardened for toughness, these guards
Nagaraj.S
All-Star
114593 Points
18503 Posts
MVP
Re: Strange Question Mart in the Output
Feb 17, 2020 03:09 PM|Rion Williams|LINK
Did you copy this value from somewhere? It looks like there are some non-printable characters that are being recognized that correspond to the '?' characters you are seeing:
You should be fine once you remove those.
Contributor
3140 Points
983 Posts
Re: Strange Question Mart in the Output
Feb 18, 2020 01:44 AM|Yang Shen|LINK
Hi nagarajasia,
This is because you are inserting non-unicode string literal into unicode field. There are some non-unicode characters before "SingLe" as @Rion mentioned.
To solved this problem, you can put an "N" before whatever you want to insert:
if OBJECT_ID('tempdb..#TB_SPECS') is not null drop table #TB_SPECS CREATE TABLE #TB_SPECS ( STRING_VALUE NVARCHAR(MAX) ) INSERT #TB_SPECS(STRING_VALUE) VALUES(N'SingLe heat-treated and fully thru-hardened for toughness, these guards') select * from #TB_SPECS
Best Regard,
Yang Shen
Member
34 Points
73 Posts
Re: Strange Question Mart in the Output
Feb 18, 2020 08:09 AM|nagarajasia|LINK
@ Rion Yes I copied the value from an excel sheet.
Thanks for your reply. I overwhelmed to see you answering my question in Microsoft forums, as I have already read plenty of your articles in the CSharpCorner website (Awesome articles).
I must say that something I have learned today. Thanks once again.
Nagaraj.S
Member
34 Points
73 Posts
Re: Strange Question Mart in the Output
Feb 18, 2020 08:11 AM|nagarajasia|LINK
@Yang Shen
Thanks for your reply. Your answer has opened doors to learn further for me. Thanks once again.
Nagaraj.S