I have a 3 SQL server: Server1,Server2 and Server3.
Each search has approx 50-60 databases.
In a particular database there is a table name table1 and it has a column named column1 with datatype varchar(max).
Now I want to change it's datatype to Nvarchar(500) but I can't as I dont know how much data consist in that column, If I blindly update it's datatype then it may happens that some of the data may be lossed.
So what I want is,I want to prepare a query to server level which gives me max content length of that column from entire server So I can get an idea about what is the max content length of that column.
So Based on that I can get max length and according to that max length,I can planned to alter that column.
I will be very grateful to you guys if someone can help me to prepare this query.
CHAR,VARCHAR,NCHAR,NVARCHAR
) in a database and get the maximum length stored in the that, right?