Created
March 17, 2012 20:48
-
-
Save hazzik/2065139 to your computer and use it in GitHub Desktop.
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 | |
Msg 8117, Level 16, State 1, Procedure proc1, Line 6 | |
Operand data type nvarchar(max) is invalid for avg operator. |
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] ([Id] int identity, [Some] int 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 = avg([Some]) from Table_1 | |
print @cnt | |
END | |
GO | |
insert into Table_1 ([Some]) values (1) | |
GO | |
exec proc1 | |
alter table Table_1 drop column [Some] | |
go | |
alter table Table_1 add [Some] nvarchar(max) null | |
go | |
exec proc1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment