Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 MS SQL datatype mismatch

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-05-22 : 08:05:26
msl writes "Hi,
I wrote a stored procedure as follows:

Create procedure myprocedure @empid int, @lastname nchar(50)
As
select @lastname=lastname from table xx where empid=@empid


** here xx.lastname has column type nchar.


On executing the stored procedure, I get error that int cannot be assigned to nchar

On the other hand if I change @lastname to int and select
@lastname=empid, I get no error and the empid is fetched


Please let me know what I am doing wrong.

Thank You
-msl"

dsdeming

479 Posts

Posted - 2003-05-22 : 08:46:09
It sounds like you're passing an invalid value into the @lastname parameter when you call the procedure. Are you sure your procedure call has the two parameters in the proper order?

Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-05-22 : 10:00:07

Post your calling procedure and we can help.

Sam

Go to Top of Page

1fred
Posting Yak Master

158 Posts

Posted - 2003-05-22 : 11:46:42
And why are you giving you parameter @lastname a value on your first line. You do not need this parameter then, its value will be lost and you did not used it!

Go to Top of Page
   

- Advertisement -