Connecting Tech Pros Worldwide Help | Site Map

Can you make a new table from query results in tsql?

Newbie
 
Join Date: Oct 2009
Posts: 2
#1: Oct 4 '09
I'm using MS SQL Server Visual Studio 2008.

Thanks.
ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,925
#2: Oct 7 '09

re: Can you make a new table from query results in tsql?


Try the keyword INTO.

Good luck...

--- CK
nbiswas's Avatar
Newbie
 
Join Date: May 2009
Location: India
Posts: 31
#3: 2 Weeks Ago

re: Can you make a new table from query results in tsql?


Hi,
Your question is not very clear.. Are you looking for a in-memory table?

In that case you can go ahead with

a) Common table expression(Sql Server 2005+) e.g.(with cte as (//code))

b) Table variables e.g.(declare @tbl Table(col1 int,col2 nvarchar(max))

c) Temporary table(#temp or ##temp)

d)Table Valued Parameter(Sql server 2008+)


etc.

Else, issue the create table command followed by insert into tablename values(value1,value2...value n) or insert into..select command

Hope this helps
Reply


Similar Microsoft SQL Server bytes