SYSCOLUMNS (Changing Data Types)

  • I want to utilize an update on the syscolumns table. What I want to do is change all columns with an xtype of 175 (char) to 167 (varchar). I am doing this for my tables only, obviously not system tables. I am getting the following error message:

    "Ad hoc updates to system catalogs are not enabled. The system administrator must reconfigure SQL Server to allow this."

    Can someone tell me how I enable this or if there is a procedure built into SQL Server to handle this.

    Thanks in advance for your help.

  • Updates to system tables are generally discouraged. One way to do this would be to issue the appropriate ALTER TABLE statements via a script which went out and searched all the columns and updated them. However, if you really want to go down the road of updating the syscolumns table, here's how to allow ad hoc updates:

    
    
    EXEC sp_configure 'allow updates', 1
    RECONFIGURE WITH OVERRIDE

    To disallow adhoc updates, change the 1 to 0 and run the RECONFIGURE WITH OVERRIDE option.

    K. Brian Kelley

    http://www.truthsolutions.com/

    Author: Start to Finish Guide to SQL Server Performance Monitoring

    http://www.netimpress.com/shop/product.asp?ProductID=NI-SQL1

    K. Brian Kelley
    @kbriankelley

  • I would completely discourage this.

    Script out the changes instead.

    Steve Jones

    sjones@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/sjones

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply