Friday, March 30, 2012

Need to change column properties...

I have an MSDE database filled with data. I use Web Data Admin to config
the db. In my short-sightedness I defined a column of vchar as only 12
characters when now I need 15. However since there's data in the db, the
edit option is not available for the columns. What's the best way to go
about making the change I need?
hi Terry,
Terry Olsen wrote:
> I have an MSDE database filled with data. I use Web Data Admin to
> config the db. In my short-sightedness I defined a column of vchar
> as only 12 characters when now I need 15. However since there's data
> in the db, the edit option is not available for the columns. What's
> the best way to go about making the change I need?
http://msdn.microsoft.com/library/de...aa-az_3ied.asp
SET NOCOUNT ON
USE tempdb
GO
CREATE TABLE dbo.test (
ID int NOT NULL PRIMARY KEY ,
data varchar(12) NOT NULL
)
GO
INSERT INTO dbo.test VALUES ( 1 ,'Andrea789012' )
SELECT * FROM dbo.test
GO
ALTER TABLE dbo.test
ALTER COLUMN data varchar(15)
GO
UPDATE dbo.test
SET data = 'Andrea789012345'
WHERE ID = 1
SELECT * FROM dbo.test
GO
DROP TABLE dbo.test
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.14.0 - DbaMgr ver 0.59.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

No comments:

Post a Comment