
/*------ ATD 421984 ------*/
IF EXISTS (SELECT 1 FROM SYSCOLUMNS C JOIN SYSOBJECTS T ON C.ID = T.ID AND T.XTYPE = 'U'
    WHERE T.NAME = 'LANCHECCXA' AND C.NAME = 'NUMDOCPAG' AND C.LENGTH < 100)
BEGIN
    IF (SELECT cdefault FROM SYSCOLUMNS WHERE name = 'NUMDOCPAG' and id IN (SELECT ID FROM SYSOBJECTS WHERE xtype='U' AND name='LANCHECCXA'))>0
    BEGIN
        EXEC sp_unbindefault 'LANCHECCXA.NUMDOCPAG' 
    END

    ALTER TABLE LANCHECCXA ALTER COLUMN NUMDOCPAG VARCHAR(100)
    EXEC sp_bindefault 'Dflt_Branco','LANCHECCXA.NUMDOCPAG'
END
GO