Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change data type on all char(36) columns in db
Message
From
04/09/2013 22:12:54
 
 
To
04/09/2013 22:05:59
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01582234
Message ID:
01582240
Views:
31
Yup, something very similar to that.

Now, once you have a set of the columns, you'd need to parse through them to generate a long script.

Again, I'm more tempted to open up that table that holds the necessary columns through .NET. T-SQL isn't great at this sort of things.... however, you "could" use the T-SQL "for xml" capability. The following example is one I use to show people how to take a bunch of rows and generate a single comma-separated string. This might or might not apply to what you're doing.....but here's an example...
declare @ShipMethodIDList nvarchar(1000) 

set @ShipMethodIDList = 
    stuff (  (  select distinct ',[' +  
            cast(ShipMethodID as varchar(100))  + ']'  
               from Purchasing.ShipMethod
                     for xml path('') ), 1, 1, '')
Though again, I'd be more tempted to write a short .NET script (or obviously, a fox script as well)

Again, thinking out loud, but hopefully this helps a bit.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform