Attualità e Information Technology

May 6, 2008

sp_MSforeachtable - aggiungere colonna a tutte le tabelle

Filed under: IT, SQL

Mi annoto una query che mi capita di lanciare diverse volte per aggiungere una colonna con la data di inserimento del record a tutte le tabelle

exec sp_MSforeachtable ‘ALTER TABLE ? ADD dataInserimentoRecord smalldatetime NULL DEFAULT getdate()’

Per maggiori dettagli sull’uso di sp_MSforeachtable si veda il mio vecchio post sp_msforeachtable e sp_msforeachdb

AddThis Social Bookmark Button

1 Comment »

The URI to TrackBack this entry is: http://oplero.blogsome.com/2008/05/06/sp_msforeachtable-aggiungere-colonna-a-tutte-le-tabelle/trackback/

  1. Ma solo tu puoi arrivare ad inserire una colonna in tutte le tabelle!!

    Comment by roger & garba — May 6, 2008 @ 14:20

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>


   

Get free blog up and running in minutes with Blogsome | Theme designs available here