Hi Vinesh I have been doing a similar thing recently for separating different object types prior to use for graphics production and have found making a custom workspace to be an easy way of doing this - e.g. this snippet of a workspace (I hope I haven't snipped out any essential bits...) selects point line and region objects from 'TempSelect' and saves them as three separate tables after first deleting the old versions of the three different object type tables:
Open Table "N:\GIS\243\EDB\Spatial_database\TempQueryPoints" As TempQueryPoints Interactive Open Table "N:\GIS\243\EDB\Spatial_database\TempQueryLines" As TempQueryLines Interactive Open Table "N:\GIS\243\EDB\Spatial_database\TempQueryRegions" As TempQueryRegions Interactive Open Table "TempSelect" As TEmpSelect Interactive Drop Table TempQueryPoints Drop Table TempQueryLines Drop Table TempQueryRegions Select * from TempSelect where str$(Obj)="point" or str$(Obj)="multipoint" into TempQueryJoinPoints Commit Table TempQueryJoinPoints As "N:\GIS\243\EDB\Spatial_database\TempQueryPoints.TAB" TYPE NATIVE Charset "WindowsLatin1" Select * from TempSelect where str$(Obj)="line" or str$(Obj)="polyline" or str$(Obj)="arc" into TempQueryJoinLines Commit Table TempQueryJoinLines As "N:\GIS\243\EDB\Spatial_database\TempQueryLines.TAB" TYPE NATIVE Charset "WindowsLatin1" Select * from TempSelect where str$(Obj)="Region" or str$(Obj)="Rectangle" into TempQueryJoinRegions Commit Table TempQueryJoinRegions As "N:\GIS\243\EDB\Spatial_database\TempQueryRegions.TAB" TYPE NATIVE Charset "WindowsLatin1" When the table TempQuery gets updated, I then just open the workspace and the three tables are updated. You could write a similar kind of thing to separate a table based on any category fields you have. It would of course require that your categories always remain the same between updates of the table master table. Regards Ollie -----Original Message----- From: Vinesh Govind [mailto:[EMAIL PROTECTED] Sent: 01 October 2004 11:23 To: MapInfo Lists (E-mail) Subject: MI-L Automated SQL Query MapInfo Users I have a dataset containing 55000+ records. One of the columns in my TAB file is "classification code". By writing a SQL query I am able to filter the TAB file to provide me with just a 'selected set' of records based on the classification code. However, as I need to do this possibly more than 50 times (create 50 layers!!) I was wondering if there was an "automation process" that I could use such that whenever I received an update to the dataset from our suppliers I could run a query that would produce 50 different layers based on my classification code. A colleague suggested writing a macro but forgive my ignorance as I don't know where to start. I also thought that I may be able to write a SQL select statement that would be saved as a template, though I am unsure how this would split the tables! Can anyone help? Thanks. Vinesh _______________________________________________________________________ The contents of this message do not necessarily represent the opinions, views, policy or procedures of Leicestershire County Council. This Electronic Transmission is intended only for the attention of the addressee. It may contain privileged and confidential information. If you are not the person for whom it is intended, you must not copy, distribute or take any action in reliance on it. If you have received this electronic transmission in error please notify us immediately by telephone, delete the transmission and destroy any hard copies. Nicholas Pearson Associates has used all reasonable efforts to ensure that this message and any attachments are free from viruses. Nicholas Pearson Associates Environmental Planners - Landscape Architects - Ecologists 30 Brock Street, BathBA1 2LN Tel: +44 (0) 1225 445548 Fax: +44 (0) 1225 312387 www.npaconsult.co.uk