Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Change data type on all char(36) columns in db
Message
De
04/09/2013 22:12:54
 
 
À
04/09/2013 22:05: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:
01582234
Message ID:
01582240
Vues:
30
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform