| Answer: |
To create a database table, use the SQL command CREATE TABLE. The command is pretty complex, and before you start creating tables via SQL code, be sure to read up on the command in the SQL Books On-Line. The basic structure of the CREATE TABLE statement is as follows:
CREATE TABLE TableName ( ColumnName1 Datatype Properties ColumnName2 Datatype Properties ... ColumnNameN Datatype Properties )
|
So, to create a table named FooBar with Name and Age columns, you could use the following SQL script:
CREATE TABLE FooBar ( Name varchar(50), Age int )
|
To view a short example on how to accomplish this through an ASP page, take a moment to read this ASPMessageboard post!
The above example works well for creating a database table... but what if you want to create, say, an entire Access database (including the .MDB file itself)? Fortunately Microsoft has provided a set of libraries referred to as ADOX which allow for this functionality. To learn more about ADOX be sure to read: Working with ADOX.
Happy Programming! |