Creating A New Table In Existing Access Database

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Creating A New Table In Existing Access Database

    Hi,

    I am trying to create a new table in an existing database and having some
    issues. When I use the attached code, it gives me an:

    Error Executing Database Query.

    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft
    Access Driver] Syntax error in field definition.

    and says the error is in line three <cfquery name="test"
    datasource="DSNjikuhchagi">

    I thought that maybe I should try a <cfinsert> but that seems to demand an
    already existing tablename.

    Any help for a newbie?

    Thanks in advance....



    <cfquery name="test" datasource="existingAccessDB"> create table student_list
    ( s_ID autonumber unique primary key, s_FName text, s_LName text, s_Bday
    date, s_Address text, s_City text, s_State text, s_Zip text, s_HPhone
    text, s_CPhone text, s_Email text, s_Rank text, s_LastTest date,
    s_AddlInfo memo ); </cfquery>

    PlayfulDragon&Phoenix Guest

  2. Similar Questions and Discussions

    1. Insert table - ASP and access database
      Hi, I am working towards trying to insert data in to two tables from one form. My code won't work so I have simplified everything. I...
    2. Problem with accessing table in access database
      i had a working site with iis5 winxp professional on a p4 machine. suddenly i am having problems with and the asp pages which have some updating...
    3. Merging Excel Info into existing Access Database Query
      Help! I have tons of info loaded into an excel spreadsheet that I need to transfer into an existing database in access. There is a specific Query...
    4. Creating new table with same structure as existing one
      I need to create "archive" table that will have the same structure as "production" one. When I run my program it have to create table named...
    5. HOW TO - Import all Access tables into an existing SQL Database
      Andrew, In Queary analyzer, paste the following: SELECT 'TRUNCATE TABLE ' + + char(13) +char(10) +'GO' FROM sysobjects WHERE xtype='U' run...
  3. #2

    Default Re: Creating A New Table In Existing Access Database

    There are at least two problems that I can see:

    - I think autonumber should be changed to counter
    - You need to define the size of your "text" fields: someColumn text(50)



    mxstu Guest

  4. #3

    Default Re: Creating A New Table In Existing Access Database

    Not sure if this is the case in Access, but in addition to what mxstu said, you
    might have to declare your primary key field as not null.

    Originally posted by: mxstu
    There are at least two problems that I can see:

    - I think autonumber should be changed to counter
    - You need to define the size of your "text" fields: someColumn text(50)






    Dan Bracuk Guest

  5. #4

    Default Re: Creating A New Table In Existing Access Database

    Maybe this might work better. You need the CONSTRAINT keyword. Also, since
    primary keys are unique (and not null), by definition, it would be redundant to
    include the UNIQUE constraint.

    <cfquery name="test" datasource="existingAccessDB">
    create table student_list
    (
    s_ID counter CONSTRAINT student_list_pk PRIMARY KEY,
    s_FName text,
    s_LName text,
    s_Bday date,
    s_Address text,
    s_City text,
    s_State text,
    s_Zip text,
    s_HPhone text,
    s_CPhone text,
    s_Email text,
    s_Rank text,
    s_LastTest date,
    s_AddlInfo memo
    );
    </cfquery>

    Phil

    paross1 Guest

  6. #5

    Default Re: Creating A New Table In Existing Access Database

    Thanks Phil (and everyone else) for your help. That worked great. I hope I'll be able to return the favor some how, some day.

    Ben
    PlayfulDragon&Phoenix Guest

  7. #6

    Default Re: Creating A New Table In Existing Access Database

    >Your text fields will default to 255 characters unless you specify a size

    Access lets you define a varchar column without a size? That is just awful. Why am I not suprised ;-)
    mxstu Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139