|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Wednesday, October 31, 2012 1:16 AM
Points: 127,
Visits: 348
|
|
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_NAME VARCHAR(50)
SET @PVC_APPLICATION_NAME='APPLICATION NAME1 '
Conversion failed when converting the varchar value 'APPLICATION NAME1 ' to data type int.
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Thursday, June 13, 2013 6:47 AM
Points: 847,
Visits: 770
|
|
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
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Saturday, April 13, 2013 10:02 AM
Points: 398,
Visits: 277
|
|
Please check what type of variable u have declared for @PVC_APPLICATION_NAME. I think u have declared as INT....
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Wednesday, October 31, 2012 1:16 AM
Points: 127,
Visits: 348
|
|
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;
my declaration is mentioned above
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Wednesday, May 22, 2013 7:11 AM
Points: 877,
Visits: 1,159
|
|
MonsterRocks (10/26/2010)
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; 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
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Friday, June 14, 2013 8:16 AM
Points: 2,122,
Visits: 1,083
|
|
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?
|
|
|
|