Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Copy Table Structure SQL
I had been using ADO to open the table, loop through the fields and put together a CREATE TABLE string, the execute it... now I can simply:
file = "F:\WBDEMO\TESTVS.MDB" table = "AL_FLD" new = "New_Table" Conn = "Provider=MicroSoft.Jet.OLEDB.4.0; Data Source=%file%;Jet OLEDB:Engine Type=4" DB = ObjectOpen("ADODB.Connection") DB.Open(Conn) ; If you are using a regular ODBC Source, this should work ;DB.Execute("Create %new% as Select * from %table% Where 0 = 1;") ; Here, we are using ACCESS, so use their Make-Table statement DB.Execute("SELECT * INTO %new% FROM %table% WHERE 0 = 1;") DB.Close() ObjectClose(DB) exit
stan littlefield
Article ID: W14666
Filename: Copy Table Structure With SQL.txt
File Created: 2001:02:26:12:08:14
Last Updated: 2001:02:26:12:08:14