Bevos
asked on
Access 2007: SQL Syntax error for Alter Table query
Hello, I am working in Access and want to use the query here to modify the contents of several tables. The syntax seems to be a bit off and I was hoping someone here could help. After the first line of code I get an error 'Syntax error in ALTER TABLE statement'.
Any help would be greatly appreciated!
Thanks so much in advance,
Bevo
Any help would be greatly appreciated!
Thanks so much in advance,
Bevo
ALTER TABLE tblPtCharacteristics ALTER COLUMN PtCharacteristics_ID COUNTER (100000, 1)
ALTER TABLE tblTreatmentCharacteristics ALTER COLUMN Group_ID COUNTER (100000, 1)
ALTER TABLE tblIntermediateOutcome ALTER COLUMN Intermediate_ID COUNTER (100000, 1)
ALTER TABLE tblHealthOutcomeMorbidity ALTER COLUMN Morbidity_ID COUNTER (100000, 1)
ALTER TABLE tblAdverseEvents ALTER COLUMN AE_ID COUNTER (100000, 1)
ALTER TABLE tblHealthOutcomeMortality ALTER COLUMN Mortality_ID COUNTER (100000, 1)
ALTER TABLE tblHealthOutcomeFunctionQOL ALTER COLUMN Function_ID COUNTER (100000, 1)
ALTER TABLE tblQuality ALTER COLUMN Quality_ID COUNTER (100000, 1)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sorry my bad , not refersh the page befor posting :)
ASKER
Hi, I tried this with the semi colon but it still will not work. The syntax works fine for a single alter table entry, but afterwards the error prompt points the the second Alter statement.
Anyone have an idea?
Anyone have an idea?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Raj, yes the statement works on its own.
Then can you try by execute each statement one-by-one ?
Raj
Raj
If it is SQL Server, you may try this way. Not sure whether MS Access 2007 supports it
Raj
ALTER TABLE tblPtCharacteristics ALTER COLUMN PtCharacteristics_ID COUNTER (100000, 1);
GO
ALTER TABLE tblTreatmentCharacteristics ALTER COLUMN Group_ID COUNTER (100000, 1);
GO
ALTER TABLE tblIntermediateOutcome ALTER COLUMN Intermediate_ID COUNTER (100000, 1);
GO
ALTER TABLE tblHealthOutcomeMorbidity ALTER COLUMN Morbidity_ID COUNTER (100000, 1);
GO
ALTER TABLE tblAdverseEvents ALTER COLUMN AE_ID COUNTER (100000, 1);
GO
ALTER TABLE tblHealthOutcomeMortality ALTER COLUMN Mortality_ID COUNTER (100000, 1);
GO
ALTER TABLE tblHealthOutcomeFunctionQOL ALTER COLUMN Function_ID COUNTER (100000, 1);
GO
ALTER TABLE tblQuality ALTER COLUMN Quality_ID COUNTER (100000, 1);
GO
Anyway you can try by executing each statement one-by-one, I believe it worksRaj
ASKER
Yes, this process works. Can I not have multiple Alter Table statements in the same query? I have to run this on several databases and I'd rather not have eight queries.
Thanks again,
Bevo
Thanks again,
Bevo
ASKER
Sorry the Go command doesn't seem to work, cool trick though if I ever start using SQL Server.
I believe ms access not supports executing multiple queries at once.
Raj
Raj
If my above statement is right, right option is to prepare the update queries that need to be execute and execute it to ms access 2007 db one-by-one in a loop.
Raj
Raj
ASKER
So you're saying make 8 queries and then have a loop execute each query? How would I do that if you don't mind me asking?
Thanks,
Bevo
Thanks,
Bevo
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I meant what pratima_mcs mentioned above.
Raj
Raj
ASKER
Thank you everyone who helped with this question!