Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change data type on all char(36) columns in db
Message
From
05/09/2013 01:54:26
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01582234
Message ID:
01582255
Views:
25
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.
Previous
Reply
Map
View

Click here to load this message in the networking platform