I have a database table named SIP_FLORES_FITS_STATE_CDS (Don't laugh too hard, I didn't name it this, I just maintain the sql)
and this table has three columns in it. The column I am going to be talking about is named FITS_SUFFIX
Here is a sample of some of the data in this column.
In the stored procedure at line 15 below they are converting a record value in the FITS_SUFFIX table to an integer.
This is where I am getting lost. They are converting a character value to an integer. I can understand how you could
convert the very first character to an integer, but not the entire 3 character code? For example the first record is
BAR, and when that is converted to an integer, what is the output?
Anyway, I did not include all of the stored procedure code, I just included the code below and numbered the lines,
so that I could refer to the line numbers.
1 DECLARE lchSuffix VARCHAR(3)
2 DECLARE CURS_STATE CURSOR
4 SELECT FITS_STATE_CD, FITS_PREFIX, FITS_SUFFIX
5 FROM SIP_FLORES_FITS_STATE_CDS FITS
6 WHERE FITS.FITS_ACTIVE = 1
7 ORDER BY FITS_STATE_CD
9 OPEN CURS_STATE
10 FETCH NEXT FROM CURS_STATE
11 INTO @lchStateCode, @lchPrefix, @lchSuffix
12 WHILE @@FETCH_STATUS = 0
14 OPEN CURS_STATE
15 SELECT @lchFITS_SUFFIX = CONVERT(INT, @lchSuffix)
16 SELECT @lchFITS_SUFFIX = @lchFITS_SUFFIX + 1;