Click here to Skip to main content
13,254,366 members (57,294 online)
Rate this:
Please Sign up or sign in to vote.
See more:
ALTER procedure get_validupto(@admin_id int)
as begin
if(select count(mac_id) from license_master where user_id=@admin_id)>0
set @name=(select validupto from license_master where user_id=@admin_id)
return @name
set @name='false'
return @name

Running [dbo].[get_validupto] ( @admin_id = 2 ).

Conversion failed when converting the nvarchar value '03/04/2013' to data type int.
The thread '01hw191161\c672c752-75c2-44 [53]' (0xfd4) has exited with code 0 (0x0).
No rows affected.
(0 row(s) returned)
Finished running [dbo].[get_validupto].

returned value is '04/03/2013'in varchar format... thn y i m getting this error as
"Conversion failed when converting the nvarchar value '03/04/2013' to data type int."
Posted 4-Apr-12 2:10am
Updated 4-Apr-12 3:01am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The return for a stored procedure is an integer. If you want other values returned to the caller use an output parameter or a select.[^]
Sanjeev236 5-Apr-12 2:40am
data type of the field id nvarchar,i stored value as nvarchar,thn hw can it return value in integer well the variable i am using to return the value is in nvarchar.
Mark Nischalke 5-Apr-12 7:10am
If you want to retrieve the value of this field then use a SELECT or OUTPUT parameter, as I have said. You can't use RETURN.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171114.1 | Last Updated 5 Apr 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100