PDA

View Full Version : too many fields: asp, sql add column


BarrMan
11-23-2005, 07:52 PM
<%@ Language=VBScript %>
<%
On Error Resume Next
Dim path, conn, sql
path = Server.MapPath("db1.mdb")
set conn = Server.CreateObject("ADODB.Connection")
conn.Open "provider=microsoft.jet.oledb.4.0;data source=" &path
For i = 1 To 120
SQL = "ALTER TABLE 4 ADD [o" & i & "] int"
conn.Execute SQL
Response.Write SQL & "<BR>"
Next
conn.Close
set conn = Nothing
If Err.number <> 0 Then
Response.Write Err.Description
End If
%>
The error is: "Too many fields"

raf
11-27-2005, 11:25 AM
not a mysql-question so you're in the wrong forum (should be in the Other Databases sub-forum).

the limit in MsAccess is 256 columns and since your loop tries to add 120 columns, i can imagine you're exceding this limit.
creating a table of +200 columns is not a good idea for MsAccess. if you update a column, then the RDBM creates a temporarely column to store the original value in. So on a table with 200 columns, you can only update 28 columns at a time...

without knowing your db-desing or application, i'm quite sure that you really don't need such a large number of columns...