This works. However, I have found something which I cannot understand.
In SSMS, if I execute that script, I see all the messages in the Messages tab. When I execute it from my application, I get all the messages except the number of updates. For example, in SSMS, I get this:
-------------------------
Removing index NoCountry...
DROP INDEX [NoCountry] ON [Server]
Adding Server.NoCountry-Temporary...
Updating Server.NoCountry-Temporary...
(6 row(s) affected)
Droping column Server.NoCountry...
Renaming column Server.NoCountry-Temporary...
Caution: Changing any part of an object name could break scripts and stored procedures.
Creating index Server.NoCountry...
Updating field record for Server.NoCountry...
(1 row(s) affected)
Updating Admin table...
(1 row(s) affected)
-------------------------
In my application, I get this:
-------------------------
Removing index NoCountry...
DROP INDEX [NoCountry] ON [Server]
Adding Server.NoCountry-Temporary...
Updating Server.NoCountry-Temporary...
Droping column Server.NoCountry...
Renaming column Server.NoCountry-Temporary...
Caution: Changing any part of an object name could break scripts and stored procedures.
Creating index Server.NoCountry...
Updating field record for Server.NoCountry...
Updating Admin table...
-------------------------
I do get however the Caution lines. Could this be a bug in that option?