|
-
Jan 24th, 2005, 05:08 AM
#1
Thread Starter
Fanatic Member
reordering?
dear gurus,
i'm adding a column to an access database using this code:
VB Code:
Conn.Open StrConnect
'add fields
SqlExec = "ALTER TABLE newsletters_entries ADD COLUMN Company VARCHAR(200);"
Conn.Execute SqlExec
'close
Conn.Close
and that works fine. however, this add this new column at the END of the database. is there any way to actually add it into a specified place?
thank you,
wc.
When your car breaks down,
close all windows and retry 
=> please rate all users posts! <=
-
Jan 24th, 2005, 05:14 AM
#2
Re: reordering?
I found this somewhere on the Internet. It suggests that you can use AFTER to specify where you want the column added.
Code:
ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec ...]
alter_specification:
ADD [COLUMN] create_definition [FIRST | AFTER column_name ]
or ADD [COLUMN] (create_definition, create_definition,...)
or ADD INDEX [index_name] (index_col_name,...)
or ADD PRIMARY KEY (index_col_name,...)
or ADD UNIQUE [index_name] (index_col_name,...)
or ADD FULLTEXT [index_name] (index_col_name,...)
or ADD [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...)
[reference_definition]
or ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}
or CHANGE [COLUMN] old_col_name create_definition
[FIRST | AFTER column_name]
or MODIFY [COLUMN] create_definition [FIRST | AFTER column_name]
or DROP [COLUMN] col_name
or DROP PRIMARY KEY
or DROP INDEX index_name
or DISABLE KEYS
or ENABLE KEYS
or RENAME [TO] new_tbl_name
or ORDER BY col
or table_options
This world is not my home. I'm just passing through.
-
Jan 24th, 2005, 05:49 AM
#3
Thread Starter
Fanatic Member
Re: reordering?
thank you,
i'm actually using:
VB Code:
"ALTER TABLE newsletters_entries MODIFY COLUMN [Company] AFTER [Last Name];"
but this is not working. do you know if this is SQL only or access is enough?...
When your car breaks down,
close all windows and retry 
=> please rate all users posts! <=
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|