Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Change data type on all char(36) columns in db
Message
De
05/09/2013 01:54:26
 
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:
01582234
Message ID:
01582255
Vues:
24
DECLARE @Test varchar(max)
SET @Test = ''
SELECT @Test = @Test +'ALTER TABLE '+Object_Name(Object_Id)+' ALTER COLUMN '+NAME+' Uniqueidentifiier'+CHAR(13)+CHAR(10)
 FROM sys.columns
 WHERE system_type_id = 175 
   AND max_length = 36
   AND Object_Name(Object_Id) NOT LIKE 'sys%'
 print @test
(Slaps head) - I had forgotten you could concatenate inline. Boris wins the refactoring award! Thanks.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform