• My appologies.

    What I am doing is creating a query that will simply take certain columns from a table and export them to a csv file for export to another server. The export is for EMS calls and the data will include all of the unit status information for the incident. All of the other columns that I need to include in this query I'm able to retrieve with no issue. The problem is that I only need 2 types of data from the column I listed and I need to be able to seperate the retrived data and create a seperate column for each data type in the export file.

    Here is what I have so far:

    SELECT

    incident_num AS IncidentNumber, incident_date AS IncidentDateTime, e911_time AS PsapCallDateTime,

    rec_time AS DispatchNotifiedDateTime, disp_time AS UnitNotifiedDispatchDateTime, enr_time AS UnitEnRouteDateTime,

    arv_time AS UnitArrivedSceneDateTime,

    -- This is where the CAD_COMMAND_CODE for UnitLeftScene and PatientArrivedDest fields will live.

    clr_time AS UnitBackInServiceDateTime, location AS StreetAddress, address AS StreetAddress2,

    city_code AS City, call_type AS EmdCardNumber, disposition_code AS DestinationCode

    FROM

    cfs_incident_core

    As you can see I am aliasing each column of the table to match the expected format for the other server.

    Also I seem to have made a mistake in my first post. Each query should have a different Alias. The query for the 'AH' data should have been aliased as PatientArrivedDestDateTime. Again my apologies!

    Also I'm using MS SQL SVR 2000.