How to determine the value of a field after it has been selected from a varchar field of 1 table and converted to an INT type value and inserted into another Sybase table with a field type of INT ?

I am inserting records into a Sybase Table using
I am using a C# program to read in the records from a txt file named InputFile.txt into a Sybase table titled tableA.
One of the fields I read into tableA has a title "age" which has a datatype of varchar(3).
Let's say I read in the records as follows:

                   while ((line = file.ReadLine()) != null)
                        DataRow row = dt.NewRow();
                        row["age"] = line.Substring(45, 3);

Then I select the records from tableA insert them into another table, tableB that has a field titled "AgeDays" that is an INT type field. This is carried out as follows:

            AgeDays  )      
           CONVERT(INT, W.age) * 1 AS Expr4

If a record in the InputFile.txt has an Age value of '000' that is imported into the field tableA.age, what value would appear in tableB.AgeDays after the insertion statement is executed?
Who is Participating?
Kyle AbrahamsSenior .Net DeveloperCommented:
000 is cast to 0 . . . 0 * 1 = 0.
Since it is being inserted into an int field, the value will have all leading 0s stripped (000 -> 0, 001 -> 1, 010 -> 10, etc).
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.