2012-09-07 95 views

回答

2

尝试是这样的(你需要创建一个新列,具有转换更新,删除旧的一个然后用旧名称重命名新的)

ALTER TABLE dbo.Garantor 
ADD newBirthDate int NOT NULL DEFAULT 0 -- NULL and DEFAULT as required 
GO 

UPDATE dbo.Garantor 
SET newBirthDate = CAST([Birth Date] AS int) -- or CONVERT function, it will do the same 
GO 

ALTER TABLE dbo.Garantor 
DROP COLUMN [Birth Date] 
GO 

SP_RENAME 'dbo.Garantor.newBirthDate', 'dbo.Garantor.[Birth Date]' 
GO 
+0

如果列都是空值,可以将其更改为varchar,然后将其更改为int。那可行。 –

相关问题