saturation
asked on
Convert all datatype nchar to nvarch on database
I want to create a SQL statement that does the following
a) converts all nchar to nvarchar
b) trims off extra spaces from the fixed width: RTRIM(LTRIM(xxxxx_fieldnam e))
c) performs this action only on database tables, not views
I know the following select statement gets the schema, but I have no idea how to perform the actions above on each field--can someone help?
select TABLE_NAME, COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, ORDINAL_POSITION
from information_schema.columns
where data_type = 'nchar'
order by 1,3
a) converts all nchar to nvarchar
b) trims off extra spaces from the fixed width: RTRIM(LTRIM(xxxxx_fieldnam
c) performs this action only on database tables, not views
I know the following select statement gets the schema, but I have no idea how to perform the actions above on each field--can someone help?
select TABLE_NAME, COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, ORDINAL_POSITION
from information_schema.columns
where data_type = 'nchar'
order by 1,3
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.