Link to home
Start Free TrialLog in
Avatar of adnan_from_hiit
adnan_from_hiit

asked on

"Create Table" query for MS Access Databases

Hi again,

    I've two questions to ask

1 - Can we use the use the "Create table" query to make new tables within our database? Make sure I'm talking about MS Access Database. If we can, then what syntax shall be used to create table n how the datatypes must be defined. Moreover, if I use a field that receives the input string as Integer and it gets out of the integer range, then how we shall arrange the field. In Access we can simply do that by setting the "Field Size" to double n add the no. of decimal places. Hw it shall be used while creating a data field?


2 - Secondly, if the database is already ready, but missed to add one more field within it, then what syntax shall I use to add the missing field in the already exisiting database? Lets say I made a database named "Profile.mdb" containing "FName", "Lname" as basic fields but I need to add one more field within it using the online script. Then I definitely won't update the databse back again to overwrite the past one. What alternate shall be used instead of uploading to add our required fields within the exiting n uploaded database?

           Will wait for ur replies. Bye
SOLUTION
Avatar of Ayesha_K
Ayesha_K

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of adnan_from_hiit
adnan_from_hiit

ASKER

thanx Ayesha n what abt creating field accept integer value as Double(Field Size)
2- alter table TestTable
add column TestNewColumn1 float
thanx once again... any idea of renaming the existing data field within a table and to rename a table
You could open access, single click on the table name TWICE and rename it.

also select the table and click Design ... and you can add a variable or edit the variable names / types.

Make sure that if you edit the variable type, you may lose data.

:) SD
Here is more info if you need to Alter the table.

ALTER TABLE table
{ADD {COLUMN field type[(size)] [NOT NULL] [CONSTRAINT index] |
CONSTRAINT multifieldindex} |
DROP {COLUMN field | CONSTRAINT indexname} }

http://www.devguru.com/Technologies/jetsql/quickref/alter_table.html
I'm asking to change it using online script not manually

I'm already aware of that

I've tried RENAME TABLE F1 TO F2

It changes the table name

what to do to change the data field in existing table
any idea ????
One way to rename a column in Access is ...

sql = "ALTER TABLE MyTable ADD NewName VARCHAR(50)"

sql = "UPDATE MyTable SET NewName = OldName"

sql = "ALTER TABLE MyTable DROP OldName"

Coz "rename column" doesnt work in Access

Also here is more info on renaming tables. http://www.4guysfromrolla.com/webtech/tips/t030802-1.shtml
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The clauses to rename columns and tables are Postgres extensions from SQL92.  

that is why we can not simply rename tables and columns through the rename command as we do in SQL Server or oracle.