x

[Closed] What is the issue here in the code?

Guys

i am learning to write procedures and, i am kind of stuck, trying to execute this.. I am not sure why is the error

CREATE PROCEDURE CreateIdentity
 (
  @AliasName varchar(50),
  @id int output
 )
AS

BEGIN
  SELECT @id = ISNULL(max(IdentifiedObjectId),0) + 1 
  from A.IdentifiedObject
  INSERT INTO A.IdentifiedObject 
  VALUES (@AliasName, '', '', '', @AliasName, '', @id, NULL)
END
GO


DECLARE @id int
EXEC CreateIdentity ENTITY, @id output

print @id

ERROR::: Msg 8114, Level 16, State 5, Procedure CreateIdentity, Line 0 Error converting data type nvarchar to int.

more ▼

asked Aug 16 '10 at 01:02 PM in Default

Katie 1 gravatar image

Katie 1
1.4k 129 163 202

What's the schema for the IdentifiedObject table?
Aug 16 '10 at 01:12 PM ThomasRushton ♦
Schema is dbo. dbo.identifiedobject
Aug 16 '10 at 01:17 PM Katie 1
(comments are locked)
10|1200 characters needed characters left

The question has been closed Aug 16 '10 at 01:10 PM by TimothyAWiseman for the following reason:


0 answers: sort oldest

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x1816
x401
x14

asked: Aug 16 '10 at 01:02 PM

Seen: 707 times

Last Updated: Aug 16 '10 at 01:24 PM