I recently had some problems altering a column in a table in the SQL Server 2005 June CTP version. I continually ran into an error that the Timeout Exceeded. After much deliberation about what the problem was, I ended up returning to good old TSQL to alter the column and it worked like a champ. Here is my two cents on why the timeout occured.
The table I was adjusting is very large. In fact, it contains an image data field that can hold pdf's, ppt's, word documents, mp3 files, etc. I was trying to alter an nvarchar field to accept 75 characters instead of 50. When using the GUI in SQL Server, an alter table resaves all things that relate to the table. In otherwords, the foreign keys, indexes, altered columns, everything. The process took so long (> 30 seconds) and therefore would timeout. Since I was only executing one ALTER TABLE ALTER COLUMN statement, it was incredibly quick and painless (< 1 second). In fact, these types of changes make me wonder if SQL Server Management Studio should be used at all to make changes. I would have thought that by now the interface would have been smart enough to notice (via a comparison) that my change didn't need to resave everything. Oh well, maybe this will be true in SQL Server 3005 ;)
No comments:
Post a Comment