If collation of two columns is different then SQL server throws and exception when migrating data between the columns like so
Cannot resolve the
collation conflict between "SQL_Latin1_General_CP1_CI_AS" and
"Latin1_General_CI_AS" in the equal to operation.
Thus we need to know about collation of the columns if we want to migrate information from one column to the other. I tried to open sys.sp_help stored procedure and figured out that its possible to read collation information of a column with following statements
declare @objid int
declare @sysobj_type char(2)
select @objid = object_id,
@sysobj_type = type
from sys.all_objects where object_id = object_id('<Table Name>')
select collation_name from
sys.all_columns where object_id = @objid
and name = '<Column Name>'
No comments:
Post a Comment