Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Too much validation from SQL Server
Message
From
26/02/2010 02:45:59
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01451147
Message ID:
01451152
Views:
36
BTW, in a sequence like this, I cannot use the GO approach to make this work. Do you know what would be the best approach to have this entire script to execute ok?
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Advertis' AND COLUMN_NAME = 'AddUser')
   BEGIN
      ALTER TABLE [Advertis] ADD [AddUser] int
   END
   ELSE
   BEGIN
      ALTER TABLE [Advertis] ADD [AddUserTemporary] int
      UPDATE [Advertis] SET [AddUserTemporary]=AddUser
      ALTER TABLE [Advertis] DROP COLUMN [AddUser]
      EXEC sp_RENAME 'Advertis.AddUser-Temporary', 'AddUser' , 'COLUMN'
   END
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Reply
Map
View

Click here to load this message in the networking platform