x

Programmatically remove schemabinding

I'm writing a sql script to handle updating a database from v1.0 of an app to v1.1.

I'm modifying a table that a view was created against with schemabinding.

Is there a way (using SQL) to momentarily turn off schemabinding for the view, modify the table, then turn schemabinding back on?

Or am I going to have to drop the view, modify the table, then recreate the view?

more ▼

asked Apr 26, 2010 at 06:12 PM in Default

ZaijiaN gravatar image

ZaijiaN
24 1 1 1

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

It's drop the view (and anything else in the dependency tree that depends on that view) and then re-create it. SSMS behaves in funny ways when doing these things sometimes (for example, helpfully dropping SCHEMABINDING left right and centre) - so tread carefully when making changes from within that particular IDE.

One day I will support this style of operation in my tools, but it's a long way off because I have heaps of other stuff to write first, and I can't think of any alternatives off the top of my head, sorry.

more ▼

answered Apr 26, 2010 at 06:22 PM

Matt Whitfield gravatar image

Matt Whitfield ♦♦
29.5k 61 65 87

Glad to see people don't use BOL here, either. ;-) Makes for lots and lots of points for posts.
May 14, 2010 at 09:23 PM Jeff Moden
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x1951
x991
x742

asked: Apr 26, 2010 at 06:12 PM

Seen: 3367 times

Last Updated: Apr 26, 2010 at 06:12 PM