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 ?
Posted on 2016-11-09
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:
INSERT INTO tableB (
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?