Hi all,
I’m trying to run this SQL statement in 2005 express;
‘ALTER TABLE test ALTER COLUMN testfield varchar(5600) NULL’
Testfield exists in database as a varchar(8000).
Express bombs with;
Msg 211, Level 23, State 7, Line 1
Possible schema corruption. Run DBCC CHECKCATALOG.
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
Thanks in advance.
Tristan

SQL ALTER COLUMN causes a Possible schema corruption.
chaser7016
CHTHONIC
I have a Understanding of TSQL, I’m a developer not database specialist… and there is no hardware or corruption issues, I have ran the same statement on multiple machines but they all present the same error.
And scripting out the action with Express this is the output.
/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
GO
ALTER TABLE dbo.connect
DROP CONSTRAINT DF__connect__records__15E52B55
GO
CREATE TABLE dbo.Tmp_connect
(
connectid bigint NOT NULL,
code nvarchar(20) NULL,
name nvarchar(60) NULL,
address1 nvarchar(40) NULL,
address2 nvarchar(40) NULL,
address3 nvarchar(40) NULL,
address4 nvarchar(40) NULL,
address5 nvarchar(40) NULL,
postcode nvarchar(10) NULL,
telephone nvarchar(50) NULL,
fax nvarchar(50) NULL,
mobile nvarchar(50) NULL,
email nvarchar(50) NULL,
weburl nvarchar(50) NULL,
areaid int NULL,
regionid int NULL,
supplierid bigint NULL,
associateid bigint NULL,
versionid int NULL,
batchid int NULL,
recordstatusid int NULL,
notes varchar(2600) NULL,
titleid int NULL,
firstname nvarchar(60) NULL,
surname nvarchar(60) NULL,
middlename nvarchar(60) NULL,
nametypeid int NULL,
photofilename nvarchar(255) NULL,
customerid bigint NULL
) ON [PRIMARY]
GO
ALTER TABLE dbo.Tmp_connect ADD CONSTRAINT
DF__connect__records__15E52B55 DEFAULT (0) FOR recordstatusid
GO
IF EXISTS(SELECT * FROM dbo.connect)
EXEC('INSERT INTO dbo.Tmp_connect (connectid, code, name, address1, address2, address3, address4, address5, postcode, telephone, fax, mobile, email, weburl, areaid, regionid, supplierid, associateid, versionid, batchid, recordstatusid, notes, titleid, firstname, surname, middlename, nametypeid, photofilename, customerid)
SELECT connectid, code, name, address1, address2, address3, address4, address5, postcode, telephone, fax, mobile, email, weburl, areaid, regionid, supplierid, associateid, versionid, batchid, recordstatusid, CONVERT(varchar(2600), notes), titleid, firstname, surname, middlename, nametypeid, photofilename, customerid FROM dbo.connect WITH (HOLDLOCK TABLOCKX)')
GO
DROP TABLE dbo.connect
GO
EXECUTE sp_rename N'dbo.Tmp_connect', N'connect', 'OBJECT'
GO
ALTER TABLE dbo.connect ADD CONSTRAINT
PK_connect PRIMARY KEY CLUSTERED
(
connectid
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
COMMIT
A little excessive for 1 change don’t you think But thanks for you help.
Chandra B
Could you run the commands
DBCC CHECKCATALOG on the database and
DBCC CHECKTABLE on the table
and report the results
mehmet bey
Discoman
Also to mention this SQL statement is being run using ADO in VB6 when catching the error the error object description is ‘Communication Link Failure”
If that throw’s any light on the problem for anyone.
Thanks
Tristan
kenc2005
GianniAb
THHNO
USE
test;GO
DBCC
CHECKCATALOGGO
'Command(s) completed successfully.'
USE
test;GO
DBCC
CHECKTABLE ('connect')GO
'DBCC results for '
connect'.There are 4661 rows in 209 pages for object "connect".
DBCC execution completed. If DBCC printed error messages, contact your system administrator.'
Tristan
InvertedAerials
Thanks for your response; all of your points are valid … with further investigation, I decided to script out an alter column in express guess what; Express creates a TMP table then copies all the data back into the new structure… all that server load for a change column statement.
Bottom line Sql Express 2005 does not support a true SQL alter column statement.
Thanks for all the help from everyone.