Solved

Cannot Convert between Unicode and Non Unicode String Data Type

Posted on 2014-07-24
7
361 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 32

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 32

Expert Comment

by:ste5an
ID: 40217005
???
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this article—a derivative of my DaytaBase.org blog post (http://daytabase.org/2011/06/18/what-week-is-it/)—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
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…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

760 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

17 Experts available now in Live!

Get 1:1 Help Now