x
login about faq Site discussion (meta-askssc)

[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 106 161 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 voted first

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



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x1601
x340
x14

asked: Aug 16 '10 at 01:02 PM

Seen: 457 times

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

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.