Click to See Complete Forum and Search --> : Problem with SQL Create table


Geof
July 10th, 2003, 04:01 PM
I have a VC apllication who write a table in Access 2000 database. I use a SQL string to create my table but when it execute my string it return me a error.

My table

Numero --> integer ( 4 )
Pos -- > char (1)
Hauteur --> double (2,1)
DD --> double (2,1)

code creating the database :
AfxGetModuleState()->m_dwVersion = 0x0601;
CDaoDatabase db;
CDaoRecordset recset(&db);
db.Create ( PathBD, dbLangGeneral, 0x40 );

My SQL string to create table:
CString SqlCmd = "CREATE TABLE TableDD ( Numero number(4), Pos char(1), Hauteur decimal(2,1), DD decimal(2,1) )";

It call me a syntaxe error

if I use the same string with only char type, I don't have any error
CString SqlCmd = "CREATE TABLE TableDD ( Numero char(4), Position char(1), Hauteur char(3), DD char(3) )";

thanks

antares686
July 11th, 2003, 06:34 AM
Read this it should help. There is even a create table statement with all supported DDL options done.

HOWTO: Common DDL SQL for the Microsoft Access Database Engine (http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q180/8/41.asp&NoWebContent=1)