you can easily create a table from the results of a SELECT by using SELECT INTO. The datatypes will be implicitly determined by the underlying data.SELECT <column List>INTO <newTableName>FROM <from clause>WHERE <where clause>
And you should use the information.schema views rather than system tables:select column_namefrom information_schema.columnswhere table_name = @tableNameand columnProperty(object_id(table_name), column_name, 'isidentity') = 0order by ordinal_position
Be One with the OptimizerTG