all groups > inetserver asp db > july 2003 >
You're in the

inetserver asp db

group:

Adding a new column in Access


Re: Adding a new column in Access Ray at <%=sLocation%
7/29/2003 12:49:48 AM
inetserver asp db:
I'm sure someone will correct me if I'm wrong, but I don't believe you can
specify "after columnname" when you add a column in Access. It'll just get
added to the end. So, this would work, although it won't do exactly what
you want.

UpdateDB("ALTER TABLE tblConfig ADD SIMVersion varchar(10) NULL" )

Ray at home

--
Will trade ASP help for SQL Server help


[quoted text, click to view]

Adding a new column in Access Peter Richards
7/29/2003 2:31:04 PM
Hi,

Using the following ASP code:

<%
UpdateDB("ALTER TABLE tblConfig ADD SIMVersion varchar(10) NULL AFTER
Version" )

' Subroutine to update the database and check for any errors that
occured
Sub UpdateDB(strSQLCommand)
If Not Application("Debug") Then
On Error Resume Next
End If
If Not blnError Then
cnnDB.Execute (strSQLCommand)
If Err.Number <> 0 Then
blnError = True
intErrorNum = Err.Number
strErrorDesc = Err.Description
strErrorSrc = Err.Source
strErrorCmd = strSQLCommand
Err.Clear
End If
End If
End Sub
%>
.... results in the error msg:

Number: -2147217900
Source: Microsoft JET Database Engine
Description: Syntax error in ALTER TABLE statement.

Ideally, I want to add the new column AFTER a specific column. I note
you can do this in Fox Pro, MySQL, so thought I could do it in ASP for
Access or SQL Server ?

Peter
AddThis Social Bookmark Button