September 14, 2022 at 5:11 am
hi
i have changed my collation to to utf-8 that is Modern_Spanish_100_CI_AI_SC_UTF8 from SQL_Latin1_General_CP1_CI_AS
now all the varchar used in stored procedure need to be doubled ( multiplied by 2) so i have decided to replace all of the varchar in stored procedure with varchar(max) because i can search of varchar(123..) and replace them in one go by varchar(max).
So my concern is, will it create any memory or speed or etc issue.
or is there any other way to update all varchars in storedprocs , view, udfs in one go with dboule the size.
one solution is using the sys.sql_modules definition which is not looking appropriate . pls suggest.
yours sincerly
September 14, 2022 at 12:38 pm
Ooh, I would not solve this by going to VARCHAR(MAX). That could cause all sorts of performance problems. If you really have to go through this exercise, the answer is to use NVARCHAR.
HOWEVER
You can't just do this in your procedure. You'll need to do it in the structures AND the procedures.
And no, no way to do this "in one go". This is a major undertaking.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
September 14, 2022 at 6:36 pm
I'm pretty sure that you want to change to NVARCHAR(), instead. IIRC, UTF-8 is a Unicode encoding.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 15, 2022 at 11:03 am
September 15, 2022 at 11:16 am
to use UTF8 in SQL 2019 NVARCHAR is not required (see https://docs.microsoft.com/en-us/sql/relational-databases/collations/collation-and-unicode-support?view=sql-server-ver16#Unicode_Defn) - but increasing the size of the existing varchar MAY be required.
have a look at https://techcommunity.microsoft.com/t5/sql-server-blog/introducing-utf-8-support-for-sql-server/ba-p/734928
September 15, 2022 at 2:43 pm
to use UTF8 in SQL 2019 NVARCHAR is not required (see https://docs.microsoft.com/en-us/sql/relational-databases/collations/collation-and-unicode-support?view=sql-server-ver16#Unicode_Defn) - but increasing the size of the existing varchar MAY be required.
have a look at https://techcommunity.microsoft.com/t5/sql-server-blog/introducing-utf-8-support-for-sql-server/ba-p/734928
Oooooooo... thank you for that great link, Frederico. I especially found the following interesting...
With UTF-8 encoding, characters in the ASCII range (000000–00007F) require 1 byte, code points 000080–0007FF require 2 bytes, code points 000800–00FFFF require 3 bytes, and code points 0010000–0010FFFF require 4 bytes.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply