Created
January 16, 2010 18:51
-
-
Save KensoDev/278952 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @DatabaseName varchar(100), @SqlStatement varchar(1024) | |
SET ROWCOUNT 1 | |
SELECT @DatabaseName = NAME FROM SYSDATABASES ORDER BY NAME | |
WHILE @@ROWCOUNT > 0 | |
BEGIN | |
-- Change this to your own SQL statement you want to execute against your db's | |
SET @SqlStatement = 'ALTER TABLE tblUsers ALTER COLUMN email nvarchar(250) NOT NULL' | |
SELECT @SqlStatement = 'Use [' + @DatabaseName + '] exec (' + @SqlStatement + ')' | |
-- Print the command to the screen | |
PRINT (@SqlStatement) | |
-- execute the command | |
EXEC (@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