October 25, 2010 at 11:44 pm
i am getting following exception while attempting to set a alphanumeric value to varchar variable... what would be the reason?... cant i have number at the end of varchar variable?... we cant blame user if he enter number at end of a varchar variable?... any help pls
@PVC_APPLICATION_NAMEVARCHAR(50)
SET @PVC_APPLICATION_NAME='APPLICATION NAME1 '
Conversion failed when converting the varchar value 'APPLICATION NAME1 ' to data type int.
October 26, 2010 at 12:01 am
You have to use DECLARE statement in order to declare a variable. I tried this
DECLARE @PVC_APPLICATION_NAME VARCHAR(50)
SET @PVC_APPLICATION_NAME='APPLICATION NAME1 '
PRINT @PVC_APPLICATION_NAME
and it showed me as result: "APPLICATION NAME1 "
Regards,
Iulian
October 26, 2010 at 12:31 am
Please check what type of variable u have declared for @PVC_APPLICATION_NAME.
I think u have declared as INT....
October 26, 2010 at 12:34 am
DECLARE @PVC_LOGIN_USERVARCHAR(40),
@PVC_APPLICATION_IDVARCHAR(40),--yet to finish
@PVC_PROGRAM_NAMEVARCHAR(40),
@PI_RET_STATUSINT,
@PVC_RET_MSGVARCHAR(500),
@PI_RET_ERRORNUMINT,
@PVC_APPLICATION_NAMEVARCHAR(50), @pvc_dest int;
my declaration is mentioned above
October 26, 2010 at 2:36 am
MonsterRocks (10/26/2010)
DECLARE @PVC_LOGIN_USERVARCHAR(40),
@PVC_APPLICATION_IDVARCHAR(40),--yet to finish
@PVC_PROGRAM_NAMEVARCHAR(40),
@PI_RET_STATUSINT,
@PVC_RET_MSGVARCHAR(500),
@PI_RET_ERRORNUMINT,
@PVC_APPLICATION_NAMEVARCHAR(50), @pvc_dest int;
my declaration is mentioned above
As per the declaration above, I dont see any errors while executing the below code:
DECLARE @PVC_LOGIN_USER VARCHAR(40),
@PVC_APPLICATION_ID VARCHAR(40), --yet to finish
@PVC_PROGRAM_NAME VARCHAR(40),
@PI_RET_STATUS INT,
@PVC_RET_MSG VARCHAR(500),
@PI_RET_ERRORNUM INT,
@PVC_APPLICATION_NAME VARCHAR(50),
@pvc_dest int ;
SET @PVC_APPLICATION_NAME = 'APPLICATION NAME1 '
PRINT @PVC_APPLICATION_NAME
Thanks
October 27, 2010 at 5:53 am
The statements that you provided appear to be correct. Are you sure that the set command is getting the error? Could you be assigning the PVC_APPLICATION_NAME variable to an int variable or column later in the code?
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy