Skip to content

Instantly share code, notes, and snippets.

@KensoDev
Created January 16, 2010 18:51
Show Gist options
  • Save KensoDev/278951 to your computer and use it in GitHub Desktop.
Save KensoDev/278951 to your computer and use it in GitHub Desktop.
DECLARE @DatabaseName varchar(100), @SqlStatement varchar(1024)
SET ROWCOUNT 1
SELECT @DatabaseName = NAME FROM SYSDATABASES ORDER BY NAME
WHILE @@ROWCOUNT > 0
BEGIN
SET @SqlStatement = 'ALTER TABLE tblUsers ALTER COLUMN email nvarchar(250) NOT NULL'
SELECT @SqlStatement = 'Use [' + @DatabaseName + '] exec (' + @SqlStatement + ')'
PRINT (@SqlStatement)
SELECT @DatabaseName = NAME FROM SYSDATABASES WHERE NAME > @DatabaseName
ORDER BY NAME
END
SET ROWCOUNT 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment