title: Change SCHEMABINDING for existing VIEW
body: <p>I have an existing database (SSDT project as source) where I have to update a table in. I'm only changing a column type from <code>nvarchar(MAX)</code> to <code>nvachar(256)</code>. The problem is, that I have an existing view bound to this table with <code>SCHEMABINDING</code>. I'm not able to edit table column because <code>SCHEMABINDING</code> prevent changes wich influences the VIEW.</p>
  
  <p>The following script is executed in the PreDeploymentScript. When I call the <code>DROP VIEW [base].[VIEW_DEPENDING_ON_TABLE]</code> statement, the view is missing after deployment. My idea is, to disable <code>SCHEMABINDING</code> during deployment and enable it after finished. How is this possible in TSQL script? Or is there a better way to do this?</p>
  
  <pre><code>IF EXISTS ( SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS
          WHERE TABLE_SCHEMA = N'base'
          AND TABLE_NAME = 'TABLENAME'
          AND COLUMN_NAME = 'Instance'
          AND CHARACTER_MAXIMUM_LENGTH = -1)
  AND NOT EXISTS (SELECT * FROM sys.indexes WHERE name='IX_TABLENAME_Instance' AND object_id = OBJECT_ID(N'[base].[TABLENAME]'))
  BEGIN
  
  IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[base].[VIEW_DEPENDING_ON_TABLE]') AND type in (N'V'))
      BEGIN
          DROP VIEW [base].[VIEW_DEPENDING_ON_TABLE]
      END
  
  IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[base].[TABLENAME]') AND type in (N'U'))
      BEGIN
          UPDATE [base].[TABLENAME] SET [Instance] = LEFT(Instance, 256)
          ALTER TABLE [base].[TABLENAME] ALTER COLUMN [Instance] NVARCHAR(256)
      END
  
  IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[base].[TABLENAME]') AND type in (N'U'))
      BEGIN
          CREATE NONCLUSTERED INDEX [IX_TABLENAME_Instance] ON [base].[TABLENAME]
          (
              [Instance] ASC
          ) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
      END
  END
  GO
  </code></pre>