Select from a table and insert into another column of a different type using a query in ms-access

I have several txt files that contain tables with a set of different records on them that have different types of values ​​and definitions for columns. I thought to import it into a table and run a query to separate different types of records, since the identifier for it is listed in the first column. Is there a way to change the type of a column value in a query? since it will be a pain to treat them all as text. If you have any other suggestions for resolving this issue, please let me know.

Here is an example table for the two types of records provided by the website on which I retrieved data from

create table dbo.PUBACC_A2
(
      Record_Type               char(2)              null,
      unique_system_identifier  numeric(9,0)         not null,
      ULS_File_Number           char(14)             null,
      EBF_Number                varchar(30)          null,
      spectrum_manager_leasing  char(1)              null,
      defacto_transfer_leasing  char(1)              null,
      new_spectrum_leasing      char(1)              null,
      spectrum_subleasing       char(1)              null,
      xfer_control_lessee       char(1)              null,
      revision_spectrum_lease   char(1)              null,
      assignment_spectrum_lease char(1)              null,
      pfr_status        char(1)          null

)

go
create table dbo.PUBACC_AC
(
      record_type               char(2)              null,
      unique_system_identifier  numeric(9,0)         not null,
      uls_file_number           char(14)             null,
      ebf_number                varchar(30)          null,
      call_sign                 char(10)             null,
      aircraft_count            int                  null,
      type_of_carrier           char(1)              null,
      portable_indicator        char(1)              null,
      fleet_indicator           char(1)              null,
      n_number                  char(10)             null
)
+3
source share
3

, , . ms VBA

IIF(FirstColumn="value1", CDate(SecondColumn), NULL) as DateValue,
IIF(FirstColumn="value2", CDec(SecondColumn), NULL) as DecimalValue,
IIF(FirstColumn="value3", CStr(SecondColumn), NULL) as StringValue

/ SELECT.

EDIT:

, - .

) , INSERT .

) , . make table, , .

EDIT2: , , , .

, HLGEM. .

1) - RecordType char (2), Rest Memo

2) ( , RecordType), ( )

3) ,

+1

. , coummns, . , , , . . , . .

+1

, , , , , . , "" , . , , .

0

Source: https://habr.com/ru/post/1752841/


All Articles