Create a table using ASP, and copy the field type appendix of the table.

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.