Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Too much validation from SQL Server
Message
De
26/02/2010 02:45:59
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01451147
Message ID:
01451152
Vues:
37
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform