Created
March 17, 2012 16:12
-
-
Save hazzik/2061572 to your computer and use it in GitHub Desktop.
test.sql
This file contains hidden or 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
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Table_1]') AND type in (N'U')) | |
DROP TABLE [dbo].[Table_1] | |
GO | |
CREATE TABLE [dbo].[Table_1] ([Name] [nvarchar](max) NULL) | |
GO | |
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc1]') AND type in (N'P', N'PC')) | |
DROP PROCEDURE [dbo].[proc1] | |
GO | |
CREATE PROCEDURE [dbo].[proc1] | |
AS | |
BEGIN | |
declare @cnt int | |
SELECT @cnt = COUNT(Name) from Table_1 | |
print @cnt | |
END | |
GO | |
insert into Table_1 (Name) values ('hello') | |
GO | |
exec proc1 | |
exec sp_rename 'Table_1.Name', 'NewName' | |
exec proc1 |
This file contains hidden or 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
(1 row(s) affected) | |
1 | |
Caution: Changing any part of an object name could break scripts and stored procedures. | |
Msg 207, Level 16, State 1, Procedure proc1, Line 6 | |
Invalid column name 'Name'. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment