Re: How can I rename a database table?
- From: "Tom Serface" <tom.nospam@xxxxxxxxxxxxx>
- Date: Tue, 12 Feb 2008 07:54:17 -0800
You may want to ask this in an SQL group, but perhaps you'll have to write a stored procedure to do this sort of thing and it could be that the queries you do through the MFC interface are more restricted. I don't do much of that for sure, but I thought I'd offer up the suggestion.
Tom
<mark.tootell@xxxxxxxxxx> wrote in message news:cc9c5fa1-433a-46b0-a26c-a2e5bf636040@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi
I am working on a project that uses the MFC CDatabase and CRecordset
classes to handle its interfacing with an Access database. It is
necessary for the software to rename a table within existing user
databases to ensure that they are valid for use with the new version
of the software.
As a result of my limited database and MFC knowledge I am having
difficulty finding a way of renaming the table. I have tried using the
following:
try
{
theDataBase.ExecuteSQL( "RENAME oldTableName TO newTableName");
}
catch( CDBException* e)
{
e->m_strError;
}
However, it results in the following error:
"Invalid SQL statement; Expected 'Delete', 'Insert', 'Procedure',
'Select', or 'Update'."
I have also tried:
SQLExecDirect( theDataBase.m_hdbc, ... , SQL_NTS);
But at compile time I am told that m_hdbc is protected and therefore
cannot be used in this way even though MSDN suggests that I can!?
Can anyone suggest a way of renaming this table programmatically?
Thanks
.
- References:
- How can I rename a database table?
- From: mark . tootell
- How can I rename a database table?
- Prev by Date: Re: transparent CheckBox/radioBox
- Next by Date: Re: How to get the list of "Recent Documents", with code
- Previous by thread: How can I rename a database table?
- Next by thread: simple requirement related to displaying jpegs
- Index(es):
Relevant Pages
|
Loading