Create a table in an existing database
<% Set conn = server. Createobject ("ADODB. Connection ")
SQL = "provider = Microsoft. Jet. oledb.4.0; Data Source =" & server. mappath ("book. mdb ")
Conn. Open SQL
Conn. execute ("create table bbb (ID autoincrement (100), p_id text (), ee money, FF datetime default date (), GG guid, HH single default 50, II double, JJ smallint, KK long, ll image, MM memo, oo yesno not null, pp tinyint, QQ numeric (18, 4), AA binary, BB bit, CC smallint ,)")
%>
'Copy Table A to another table B (only copy structure, excluding data)
<%
set rs = server. createobject ("ADODB. recordset ")
SQL =" select * into B from a where 1 = 0 "
Rs. open SQL, Conn, 1, 1
Rs. update
Rs. close
set rs = nothing
%>
◆ 'Copy Table A to another table B (including the system structure and data)
<%
set rs = server. createobject ("ADODB. recordset ")
SQL =" select * into B from a
Rs. open SQL, Conn, 1, 1
Rs. update
Rs. close
set rs = nothing
%>
12. Create a database and create a table
<%
'create a database file
set conn = server. createobject ("ADOX. catalog ")
Conn. create "provider = Microsoft. jet. oledb.4.0; "&" Data Source = "& server. mappath ("lifeda1.mdb")
%>
<%
'create a table for the database
set rs = server. createobject ("ADOX. table ")
'table name
Rs. name = "aaaa"
'field in this table (for field types, see the relevant appendix)
Rs. columns. append "ID", 3
Rs. columns. append "liuyan", 203
Rs. columns. append "DT", 7
conn. Tables. append RS
set rs = nothing
%>
now, the table is created. Hope to help you.
Field Type appendix
203 remarks
7 Date/time
128 binary
11 Boolean
6 Currency
133 date
134 time
135 date and time
5 dual precision
4 single precision
3 digits
204 binary
202 string