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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 MS SQL datatype mismatch
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Ask SQLTeam Question

0 Posts

Posted - 05/22/2003 :  08:05:26  Show Profile  Visit AskSQLTeam's Homepage
msl writes "Hi,
I wrote a stored procedure as follows:

Create procedure myprocedure @empid int, @lastname nchar(50)
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

Constraint Violating Yak Guru

479 Posts

Posted - 05/22/2003 :  08:46:09  Show Profile
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

White Water Yakist

3467 Posts

Posted - 05/22/2003 :  10:00:07  Show Profile

Post your calling procedure and we can help.


Go to Top of Page

Posting Yak Master

158 Posts

Posted - 05/22/2003 :  11:46:42  Show Profile
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
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000