?
Solved

SQL 2005 con

Posted on 2008-10-30
5
Medium Priority
?
228 Views
Last Modified: 2010-03-19
CAn some tell me the best way to conert SQL Storedprocedure Non Unicode to Unicode. Any script out there to convert all SP with varchar , char to nvarchar nchar.

CAn you please tell me how to go about it SQL 2005
0
Comment
Question by:Abeokuta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 2000 total points
ID: 22841620
The best way is to open your source control software where you store all of your procedures, change them there, write the underlying DDL changes for altering your tables, then push it out as a migration package.

There are a lot of reason why you can't run a "convert to unicode" script.  

1. If you use the datalength() function anywhere, you now need to use datalength()/2 to get the character length of the data in the column
2. Assigning unicode strings to variables is different
  set @unicodeString = N'Hello'
  set @NONunicodeString = 'Hello'

Those are just 2 of the problems you will face trying to "convert" with some sort of code generator.
0
 

Author Comment

by:Abeokuta
ID: 22841752
Can you please site an example of the datalenght () function , you are referring to
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22842017
datalength is similar to len but does not trim.

select len('hello   ')
select datalength('hello   ')
select len(N'hello   ')
select datalength(N'hello   ')/2
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

There are some very powerful Dynamic Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a di…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

752 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