Solved

Cannot Convert between Unicode and Non Unicode String Data Type

Posted on 2014-07-24
7
362 Views
Last Modified: 2014-07-25
Hello,

In T-SQL script, if I change the following deliveryInstruction by DeliveryInstruction = ''

DeliveryInstruction = replace(replace(replace(replace(substring((select ', ' + ST_NoteText  from Test.DBO.StmNote where ST_Description = 'Import Delivery instructions' and ST_ParentID = JobShipment.JS_PK FOR XML PATH('')), 3, 1000),'
',''),ascii(13),''),ascii(10),''),'&','&'),
The following error is generated :

Cannot Convert between Unicode and Non Unicode String Data Type

Why?

Thanks

Regards
0
Comment
Question by:bibi92
  • 4
  • 2
7 Comments
 
LVL 33

Accepted Solution

by:
ste5an earned 500 total points
ID: 40216761
Please post a concise and complete example. Include table DDL and sample data.

How should we help, when you post a fragment of a statement which is not testable?

The only thing I see, why do you use REPLACE()? Add the unicode string literal marker to all your string literals (N'it'sunicode').
0
 

Author Comment

by:bibi92
ID: 40216919
Hello,

I search how to replace NTEXT column by NULL value.

Thanks

Regards
0
 
LVL 33

Expert Comment

by:ste5an
ID: 40217005
???
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

Author Comment

by:bibi92
ID: 40217085
Hello,

I try :

I have replaced DeliveryInstruction = '' by  DeliveryInstruction = CAST(N'' AS NVARCHAR(MAX)) ,


Thanks
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 40218446
We are all anxiously waiting for you to tell us what is the question?  I do realize that English may not be your first language, so just a simple query showing the wrong output and the expected output would suffice.
0
 

Author Comment

by:bibi92
ID: 40219866
Ok, I will do it for the next question. I have replaced

DeliveryInstruction = ''
by  
DeliveryInstruction = CAST(N'' AS NVARCHAR(MAX))

and the error Cannot Convert between Unicode and Non Unicode String Data Type is resolved.
0
 

Author Closing Comment

by:bibi92
ID: 40219869
This help to find a solution
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now