473,569 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
I'm using MS SQL Server Visual Studio 2008.

Thanks.
Oct 4 '09 #1
2 2057
ck9663
2,878 Recognized Expert Specialist
Try the keyword INTO.

Good luck...

--- CK
Oct 7 '09 #2
nbiswas
149 New Member
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,v alue2...value n) or insert into..select command

Hope this helps
Nov 9 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
21718
by: Stephen Miller | last post by:
Is it possible to ALTER a temporary table in TSQL (SQL2000)? The following TSQL reports a syntax error at the ALTER TABLE line: DECLARE @Test TABLE( NOT NULL , NOT NULL ) ALTER TABLE @Test DROP COLUMN Col2
11
16277
by: randi_clausen | last post by:
Using SQL against a DB2 table the 'with' key word is used to dynamically create a temporary table with an SQL statement that is retained for the duration of that SQL statement. What is the equivalent to the SQL 'with' using TSQL? If there is not one, what is the TSQL solution to creating a temporary table that is associated with an SQL...
3
1263
by: Bill | last post by:
I'm trying to devise a query for use on SQL Server 2000 that will do what was previously done with one query in MS Access. The MS Access query was like this: SELECT Count(*) as , Abs(Sum( Like 'Cancel*')) As FROM Detail_Dir_LocV Where (Detail_Dir_LocV.DateOpened > '2004-8-01') and Status not like 'Deleted' Group By Year(DateOpened),...
7
5080
by: rednexgfx_k | last post by:
All, Problem Summary: I've running about 30 make table queries via VBA in Access 2000, and my database goes from 14,000k to over 2,000,000k. In addition, the longer the procedure runs, the bigger the performance hit VBA takes. I'm wondering how to prevent or reduce this. Details: I have a database table of queries I want to run. This...
4
1881
by: roman.ali | last post by:
Hi, I am using a .dqy file to import some rows from a sql server 2003 database to microsoft excel. Unfortunately, I have am importing more rows than excel can handle. Is there a way around this? It appears that there is no equivalent of the LIMIT(offset, number of rows to return) function of mysql in tsql. Had there been an...
14
9747
by: John T Ingato | last post by:
I have a contacts table with name address and such but are missing all phone numbers in the phone number fields. I have just received an updated customer list in Excel and have imported into a new table. Can I run a query that will take the phone number only from the new table and update the old tables phone number fields from empty to the...
3
1633
by: Zammy | last post by:
Is there a way to specify different field names in a temporary table created using VBA? I just inherited a program and now the users want to export results to Excel. The original programmer only provided printed reports, so field names did not matter. The temp table is created using a query. When I export it to Excel it uses the table field...
8
2554
by: Bill Gower | last post by:
I want to store an SQL string into a table and then be able to run it later. Here is the insert command "insert into ProjectSQL(ProjectID, SQLID, SQLString) values( " & locProjectID & ", " & nID & ", '" & tSQL & "')" that I will use inside of VB The problem is that inside the string tSQL are single quoted values so I need double quotes...
11
47139
by: sphinney | last post by:
At the risk of oversimplifying my situation, here are the basic facts: * I'm writing an ACCESS 2002 VBA. * My VBA automatically uses information in one table (Table A) to repeatedly query a second table (Table B) via SQL. * Each record in Table A (which has about 800 records) represents a set of conditions by which to query Table B. ...
9
7973
by: bubbles | last post by:
Newbie transiting from VBA to TSQL, using SQL Server 2005 Enterprise: Need help to do this: Open Table_A WITH TableA DO UNTIL .EOF Read value from TableA.ColumnA Run SQL Statement on TableB based on value
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.