callshakeel
Programmer
Error in creating table in MS SQL using PHP script;
code is as below:
$qstr="CREATE TABLE Catagory(catID int(4) NOT NULL, catName varchar (15) NOT NULL,description text NULL PRIMARY KEY catID)";
$result = $conn->Execute($qstr);
$qstr="CREATE TABLE Item(itemID int(4) NOT NULL, catID int(4) NOT NULL,itemName varchar (15) NOT NULL, itemType varchar (15) NOT NULL, description text NULL PRIMARY KEY itemID FOREIGN KEY Catagory.catID)";
$result = $conn->Execute($qstr);
I'm getting the following error:
Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft OLE DB Provider for ODBC Drivers Description: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'catID'. in c:\inetpub\ on line 8
Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft OLE DB Provider for ODBC Drivers Description: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'itemID'. in c:\inetpub\ on line 11
plz help me...
code is as below:
$qstr="CREATE TABLE Catagory(catID int(4) NOT NULL, catName varchar (15) NOT NULL,description text NULL PRIMARY KEY catID)";
$result = $conn->Execute($qstr);
$qstr="CREATE TABLE Item(itemID int(4) NOT NULL, catID int(4) NOT NULL,itemName varchar (15) NOT NULL, itemType varchar (15) NOT NULL, description text NULL PRIMARY KEY itemID FOREIGN KEY Catagory.catID)";
$result = $conn->Execute($qstr);
I'm getting the following error:
Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft OLE DB Provider for ODBC Drivers Description: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'catID'. in c:\inetpub\ on line 8
Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft OLE DB Provider for ODBC Drivers Description: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'itemID'. in c:\inetpub\ on line 11
plz help me...