Create a Table From a Query

  • I would like some subsets (tables) from may main table.

    dumb q:

    How can i quickly create a new table from an existing one, without having to redefine all the columns, etc...

    thx

    f

  • Select <Field List>

    Into <New Table Name>

    From <Source table>

    But why would you want to split things out, there is the issue that the new data will not be updated when their masters have been updated?

  • Yes, there's a deeper issue that further shows my ignorance....

    I have a method being performed on text-rows, and one of the rows has some sort of curruption in the text-format, so this was some kind of way to isolate that row.

    I wonder if i can have the method performed 1 row at a time, so i can see which row is the problem.

    The error message indicates a 'position' where the unexpected text is occurring, but I don't know how to translate that 'position' to which row is causing the problem,

    any suggestions, ???

    thx

    f

  • You can create an identical, empty table (same columns only) by using: select top 0 * into New_Table_Name from My_Table

    How many rows are there in your problem table and how is the method being applied? If the table isn't too big you may be able to run through it RBAR, applying your method until you to find the problem. A unique key would help identify the row.

    If you provide some idea of how the method is applied there may be more options, i.e could it be applied as a calculated column? Then you could create a new table with 3 columns, UniqueKey, Problem Column, calculated column. Insert the data into the new table until the method fails, if you are doing this in an ordered sequence then the first row that didn't insert is your problem row.

    Hope this helps a bit.

    Leo

    Leo
    Nothing in life is ever so complicated that with a little work it can't be made more complicated.

  • TOP 0 * INTO new_table FROM existed_table

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply