I have tables,stored procedures and functions using varchar
but to support arabic text i would need to change them to nvarchar
. I have this script for tables
select cmd = 'alter table [' + c.table_schema + '].[' + c.table_name + '] alter column [' + c.column_name + '] nvarchar',* from information_schema.columns c where c.data_type='varchar' order by CHARACTER_MAXIMUM_LENGTH desc
Using this i get a query which i can copy paste and execute to change varchar to nvarchar but they default the non nullable columns to include null which is a big issue. I need to retain the nullable as nullable and non nullable as non nullable.
Next, issue is that i would have to manually edit the stored procedures and functions to implement this change wherever needed. Is there some workaround script for atleast altering the parameters safely ?
Note that do not have views in the database and some varchar
declarations have size to 8000 too.
Please give me a safe solution.