Solved

SQL 2005 con

Posted on 2008-10-30
5
195 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
  • 2
5 Comments
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 500 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

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

Title # Comments Views Activity
Another way of doing this SQL 8 46
ms sql + top 1 for each customer 3 45
How can I get this column in my query? 2 40
Can Unique column have more than one Null? 8 48
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

863 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

26 Experts available now in Live!

Get 1:1 Help Now