How to use IAlterTable  
Author Message
andy-k





PostPosted: Tue Nov 23 14:07:29 CST 2004 Top

SQL Server Developer >> How to use IAlterTable

Hi,

I would like to know how to use OleDB IAlterTable.

I'm currently working with database SQL Server 2000 CE and Access 2000 and I
need to be able to rename a table.

I just don't know where to start.
How do I get access to this interface? What are the step to get it?

Thanks

SQL Server226  
 
 
Stuart





PostPosted: Tue Nov 23 14:07:29 CST 2004 Top

SQL Server Developer >> How to use IAlterTable What provider are you using, SQLOLEDB.1?

You must call it off of IDBCreateSession::CreateSession, however SQLOLEDB.1
does not support this interface..

It does support something like 'ITableDefinition', e.g.:
Assuming m_spDataSource is created from GetDataSource...
CComPtr<IDBCreateSession> spCreateSession;
HRESULT hr = m_spDataSource->QueryInterface(__uuidof(spCreateSession),
(LPVOID*)&spCreateSession);

if (FAILED(hr))
return hr;

hr = spCreateSession->CreateSession(NULL, __uuidof(m_spCreateCommand),
(LPUNKNOWN*)&m_spCreateCommand);

if (FAILED(hr))
return hr;

CComPtr<ITableDefinition> myTableDef;
hr = spCreateSession->CreateSession(NULL, __uuidof(myTable),
(LPUNKNOWN*)&myTable);

Cheers,

Stu



> Hi,
>
> I would like to know how to use OleDB IAlterTable.
>
> I'm currently working with database SQL Server 2000 CE and Access 2000 and
I
> need to be able to rename a table.
>
> I just don't know where to start.
> How do I get access to this interface? What are the step to get it?
>
> Thanks
>
>