# Migrating Client Variable Data

If you need to migrate your client variable data to another data source, you need to know the structure of the database tables used to store this information. Client variables stored externally use two small database tables with the following simple structure. Data types shown in these tables are those used for a Microsoft Access database. Your database may require different data types.

CDATA
Column | Data Type
--- | ---
cfid | char(20)
app | char(64)
data | memo

CGLOBAL
Column | Data Type
--- | ---
cfid | char(20)
data | memo
lvisit | date

## Creating client variable tables

You can use the following example ColdFusion page as a model for creating client variable database tables in your own database. Not all databases support the same column data type names, so you may have to alter some data types for your database. Refer to your database documentation for the proper data type.

## Sample table creation page

    <!---- Create the Client variable storage
    tables in a datasource. This example applies
    to Microsoft Access databases --->

    <CFQUERY NAME="data1" DATASOURCE="#DSN#">
    CREATE TABLE CDATA
    (
        cfid char(20),
        app char(64),
        data memo
    )
    </CFQUERY>

    <CFQUERY NAME="data2" DATASOURCE="#DSN#">
        CREATE UNIQUE INDEX id1
        ON CDATA (cfid,app)
    </CFQUERY>

    <CFQUERY NAME="global1" DATASOURCE="#DSN#">
    CREATE TABLE CGLOBAL
    (
        cfid char(20),
        data memo,
        lvisit date
    )
    </CFQUERY>

    <CFQUERY NAME="global2" DATASOURCE="#DSN#">
        CREATE INDEX id2
        ON CGLOBAL (cfid)
    </CFQUERY>

    <CFQUERY NAME="global2" DATASOURCE="#DSN#">
        CREATE INDEX id3
        ON CGLOBAL (lvisit)
    </CFQUERY>