Hi.
I've got a problem.
My database is full of CHAR fields. I want to convert them into VARCHAR and RTRIM them all.... This is what i've done... But it doesn't work....
(The RTRIM is done manually, and the example below shows only one table)
Can it be done this way, or?
-- Allow config in sys tables
sp_configure 'allow updates',1
GO
-- Update syscolumns to change from CHAR to VARCHAR in ALL usertables
UPDATE syscolumns SET usertype = 2
WHERE id in (SELECT id FROM sysobjects WHERE type = "U")
AND usertype = 1
GO
-- Disallow config in sys tables
sp_configure 'allow updates',0
GO
-- Trim the Trailing spaces for every VARCHAR field in the table(s) one by one.
UPDATE Table
SET Field1 = RTRIM(Field1),
Field2 = RTRIM(Field2),
Field3 = RTRIM(Field3)
GO
//Nordlund
I've got a problem.
My database is full of CHAR fields. I want to convert them into VARCHAR and RTRIM them all.... This is what i've done... But it doesn't work....
(The RTRIM is done manually, and the example below shows only one table)
Can it be done this way, or?
-- Allow config in sys tables
sp_configure 'allow updates',1
GO
-- Update syscolumns to change from CHAR to VARCHAR in ALL usertables
UPDATE syscolumns SET usertype = 2
WHERE id in (SELECT id FROM sysobjects WHERE type = "U")
AND usertype = 1
GO
-- Disallow config in sys tables
sp_configure 'allow updates',0
GO
-- Trim the Trailing spaces for every VARCHAR field in the table(s) one by one.
UPDATE Table
SET Field1 = RTRIM(Field1),
Field2 = RTRIM(Field2),
Field3 = RTRIM(Field3)
GO
//Nordlund