change a coluimn in a SQL table while it is referenced by view

Posted on 2009-12-15
Last Modified: 2012-05-08

I need to change one of the columns in a major table , from INT to REAL. When I do that in SMSS I get the notification that I can not change the table because it is referenced to one or more views (is actually referenced to about 10 views).

Is there any way to change that column's data type to something else without have to delete and alter recreate all those views ?

happy to do in T-sql instead of SMSS ...
Question by:LukeB
    LVL 142

    Accepted Solution

    I presume the view is created WITH SCHEMABINDING.
    in which case: you CANNOT change the table without recreating the view.

    Expert Comment

    I don't think there's an easy way to do that.  Here's how I'd do it:

    1. From SSMS, generate CREATE scripts for those views and save the scripts
    2. Change the column type for that column in all of those scripts
    3. Drop the views
    4. Modify the table to change the column type
    5. Run the saved CREATE VIEW scripts to recreate the views


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
    Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now