SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
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  

AskSQLTeam
Ask SQLTeam Question

USA
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)
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
Constraint Violating Yak Guru

USA
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

SamC
White Water Yakist

USA
3462 Posts

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

Post your calling procedure and we can help.

Sam

Go to Top of Page

1fred
Posting Yak Master

Canada
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.06 seconds. Powered By: Snitz Forums 2000