Solved

unicode and non-unicode string

Posted on 2008-10-17
6
1,026 Views
Last Modified: 2013-11-10
cannot convert between unicode and non-unicode string.  The custdesc in sql table is ntext and casted as nvarchar(1000) in sql cmmand that pulls info into excel.   I have changed the excel  create table sql to
custdesc nvarchar(1000)  ,custdesc ntext null .  it does not seem to be working..any inputs?
0
Comment
Question by:ohemaa
  • 3
  • 2
6 Comments
 
LVL 39

Assisted Solution

by:BrandonGalderisi
BrandonGalderisi earned 100 total points
ID: 22745673
Not sure what EXACTLY what you're doing, but it seems like you are trying to export data from SQL 2005 to excel?

Well for starters you should be using nvarchar(max) instead of ntext in your SQL 2005 tables.

text and ntext and scheduled to be removed in future versions: http://msdn.microsoft.com/en-us/library/ms187993(SQL.90).aspx

Perhaps you could create a view that casts your ntext to nvarchar(max).

create view vw_Customer
as
select cust.name, cast(cust.custdesc as nvarchar(max)) as custdesc
from customer cust
GO

Then try using the view as your source.
0
 
LVL 17

Accepted Solution

by:
HoggZilla earned 400 total points
ID: 22745691
Using the Advanced Edit, check the column datatypes for both SQL and Excel. Even if you CAST in the Source SQL it might be confused? Also, SSIS is very sensitive about nvarchar and varchar (unicode and non-unicode). It also hates NTEXT, there are some other workarounds.
Post your SQL Source and the Create Table for your Excel Destination for more input.
0
 

Author Comment

by:ohemaa
ID: 22758622
Checking Advanced Editor inputs outputs pro.

SQl inputs
Name      CustomerInfo
Datatype  String[Dt_str]
Length     (1000)

Excel outputs

Name      CustomerInfo
Datatype  String[Dt_str]
Length    (1000)
 but I still get customerinfo cannot convert between unicode and non unicode string data types
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 17

Assisted Solution

by:HoggZilla
HoggZilla earned 400 total points
ID: 22759269
There is another simple route you can try. Create a new package using the wizard allowing SSIS to create the Excel Destination table.
You could also try changing the database datatypes from nvarchar to varchar.
0
 

Author Comment

by:ohemaa
ID: 22780337
solution from google.  add data conversion and convert customerinfo to unicode
0
 
LVL 17

Expert Comment

by:HoggZilla
ID: 22780702
OK, a Data Conversion task could work but I am not sure why you are selecting a column from SQL with NTEXT and it becomes a DT_STRING? If the column in SQL is NTEXT and you select it asis, it will come into SSIS as "Unicode text stream [DT_NTEXT]"
Since Excel only understands 6 datatypes from SSIS, see below, and DT_NTEXT is one of them, you should not be getting a unicode coversion error.
SSIS to Excel Datatypes:
Numeric  double-precision float (DT_R8)
Currency  currency (DT_CY)
Boolean  Boolean (DT_BOOL)
Date/time  date (DT_DATE)
String  Unicode string, length 255 (DT_WSTR)
Memo  Unicode text stream (DT_NTEXT)
 
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
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.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

828 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