create table as select

  • Hi,

    In Oracle, it uses Create Table as Select...... to create an identical table with data loaded.

    How T-SQL does for the same thing?

    Thank you.

  • this creates a temporary table #a:

    select name

    into #a

    from sysobjects

    select * from #a

  • maybe you could try like this in your SP or query:

    create table #temp(@field1 int,@field2 varchar(10))

    insert into #temp

           select a,b from tableFrom

     

    select * from #a

    then, when you're not using the table again,

    drop table #a

  • in T-SQL You can do it with the following syntax

    select * into from

    example

    select * into mytable from sysobjects

  • n T-SQL You can do it with the following syntax

    select * into [new_table_name]from [table_name]

    example

    select * into mytable from sysobjects

    You Store, I Manage

  • thanx yaar ur tip was awesome ...

    i tried it .. n it worked

  • select * into new_table from old_table

  • Hi,

    you can make use of temporary table as follows:

    select * into #TempTable from SourceTable

    Regards,

    Avaneesh.

Viewing 8 posts - 1 through 7 (of 7 total)

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