Access scripts in "Community Submitted Scripts" by Kent Finkle Q1

Discussion in 'Scripting' started by David Schrader, Oct 3, 2006.

  1. Kent,

    Two questions, one each addressed in a message to this NG as
    directed by the web page at the Microsoft site. Wish I'd been
    able to do this via e-mail to reduce network traffic.

    I've downloaded all of your scripts which show how to create
    and populate an "Access" database using MS scripts - some-
    thing I've been trying to do for quite some time but haven't
    been able to find anything about (until I found your pages
    at the MS site). I've tried them all and they all work just
    and written and even with a bit of fiddling to allow for the
    change of file name(s) and locations, table names and columns
    (or fields) names it still all works perfect.

    Question 1:

    The first question has to do with the creation of columns
    (or fields). In one of your examples you showed:

    sql = "ALTER TABLE Hardware ADD COLUMN Dt DATE"

    where the column name was "Dt" and the "type" of data to be
    stored in the column/field was (of type) "DATE," In another
    of your examples you specify:

    sql = "CREATE TABLE Hardware (Device Text, Location Text)"

    in which both fields are specified as type "Text." My first
    question is, is there a way to specify the other characteristics
    of the field? For example, if the "Text" field would never be
    longer than "50" characters would you put:

    sql = "CREATE TABLE Hardware (Device Text 50, Location Text)"

    Could you clarify that point for me a little?

    Hope to hear from you soon.

    David Schrader
    Florida State University
     
    David Schrader, Oct 3, 2006
    #1
    1. Advertisements

  2. David Schrader

    Marco Shaw Guest

    in which both fields are specified as type "Text." My first
    A good link for some of the options here is this:
    http://www.w3schools.com/sql/sql_create.asp

    So, your sql code above should look like this:
    sql = "CREATE TABLE Hardware (Device varchar(50), Location varchar)"

    The last varchar does not have a lenght specified...

    Marco
     
    Marco Shaw, Oct 6, 2006
    #2
    1. Advertisements

  3. Thank you Marco. I'll look into this reference.
    (I know - I figured that if I got one the other
    would follow... .)

    David
     
    David Schrader, Oct 10, 2006
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.