I need to alter a varchar column to be a uniqueidentifier in code so I've created a temporary column that is a uniqueidentifier and need to copy the values from the old column to my temporary column. Only this generates an error that it cannot convert a varchar into a uniqueidentifier. Enterprise Manager creates a temporary table and uses this statement: IF EXISTS(SELECT * FROM dbo.test)
EXEC('INSERT INTO dbo.Tmp_test (t_NAME, t_TYPE, t_NEW_FLAG, RowGuid)
SELECT t_name, t_TYPE, t_NEW_FLAG, CONVERT(uniqueidentifier, RowGuid) FROM dbo.test TABLOCKX').
Can this statement be modified into an update statement? Everything I've tried so far gives me that same error that it cannot convert a varchar into a uniqueidentifier.
EXEC('INSERT INTO dbo.Tmp_test (t_NAME, t_TYPE, t_NEW_FLAG, RowGuid)
SELECT t_name, t_TYPE, t_NEW_FLAG, CONVERT(uniqueidentifier, RowGuid) FROM dbo.test TABLOCKX').
Can this statement be modified into an update statement? Everything I've tried so far gives me that same error that it cannot convert a varchar into a uniqueidentifier.