473,795 Members | 3,167 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to store the result set in temp table

rsrinivasan
221 New Member
Hi all,

When i run below statement, i get some result set. But i want to store the results sets in some temp table. How can i store it?

Expand|Select|Wrap|Line Numbers
  1. DBCC SHOWCONTIG ('table_name') WITH TABLERESULTS
Thanks,
Aug 20 '08 #1
5 5282
ck9663
2,878 Recognized Expert Specialist
You might need to get the info you need from one of the system tables or system views.

-- CK
Aug 20 '08 #2
rsrinivasan
221 New Member
You might need to get the info you need from one of the system tables or system views.

-- CK
So what to do for this to store this result in some temp table. I do not have any idea to implement this. please suggest some way to do this.
Aug 21 '08 #3
JinxT
9 New Member
Hi,

Take a look at this link :
http://www.sqlserverce ntral.com/Forums/Topic550007-5-1.aspx

J.
Aug 21 '08 #4
ck9663
2,878 Recognized Expert Specialist
JinxT is right, it can be done :)

Check sample E from here

specifically, the lines:

Expand|Select|Wrap|Line Numbers
  1. BEGIN
  2. -- Do the showcontig of all indexes of the table
  3.    INSERT INTO #fraglist 
  4.    EXEC ('DBCC SHOWCONTIG (''' + @tablename + ''') 
  5.       WITH FAST, TABLERESULTS, ALL_INDEXES, NO_INFOMSGS')
  6.    FETCH NEXT
  7.       FROM tables
  8.       INTO @tablename
  9. END

-- CK
Aug 21 '08 #5
rsrinivasan
221 New Member
JinxT is right, it can be done :)

Check sample E from here

specifically, the lines:

Expand|Select|Wrap|Line Numbers
  1. BEGIN
  2. -- Do the showcontig of all indexes of the table
  3.    INSERT INTO #fraglist 
  4.    EXEC ('DBCC SHOWCONTIG (''' + @tablename + ''') 
  5.       WITH FAST, TABLERESULTS, ALL_INDEXES, NO_INFOMSGS')
  6.    FETCH NEXT
  7.       FROM tables
  8.       INTO @tablename
  9. END

-- CK
Thanks for it. It is working fine.
Aug 25 '08 #6

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

Similar topics

11
13754
by: Surajit Laha | last post by:
I am firing a query like: SELECT TaskName, StartDate FROMTasks WHERE StartDate >= '01-Aug-2003' Now the result comes as: TaskName StartDate -------------------------- Task1 01-Aug-2003
3
39505
by: thirdman | last post by:
I'm trying to write a SQL that stores a result from a stored-procedure into a temporary table. Is there any way of doing this?
1
541
by: Alessandro | last post by:
Hi, here is the problem... I must create a store procedure that do the following... 1. select id_name,...'some other field' from table 'data' where 'criteria' = @parameter 2. use the result of the first selection to create another selection combining that results with the table 'name' where id_name is null in the result selection...
1
4203
by: Karl.Auer | last post by:
Hello group! i have a table "group_code" wich relates the names of nt-(domain)-groups to codes. now i want use the stored procedure xp_logininfo (asking for the group-membership of the current user) to join the result to "group_code". then i must use the new result (the code) to join against other tables. i know now, that i cant join results of SPs against tables. may be that a UDF with a table result is the correct approach. but i...
8
8642
by: gacuna | last post by:
i want to insert into a temporal table the result of a store procedure. on sql server the sentence would look like this (already working) INSERT INTO #SHIPINFO exec TESTDTA.S59RSH05 @SCBILLTO, @INID, @ADRSTYPE i tried to do the same on DB2, meaning INSERT INTO SESSION.SHIPINFO CALL TESTDTA.S59RSH05 v_SCBILLTO, v_INID, v_ADRSTYPE
9
2701
by: serge | last post by:
/* Subject: How to build a procedure that returns different numbers of columns as a result based on a parameter. You can copy/paste this whole post in SQL Query Analyzer or Management Studio and run it once you've made sure there is no harmful code. Currently we have several stored procedures which final result is a select with several joins that returns many
4
2587
by: ipez75 | last post by:
Hello everyone, I have a web application written in asp 6.0, my problem is that I execute a sql server store procedure and I get an empty recordset, while executing the same sp on query anlyzer I can see 5 records. Basically the sp create a temp table, populate it, and lastly selects the results from the temp table. I read on a preceding post to insert the clause: "SET NOCOUNT ON" to avoid getting closed recordset of the insert statements, so...
0
2569
by: Mark C. Stock | last post by:
"Mark C. Stock" <mcstockX@Xenquery .comwrote in message news:... | | "Berend" <Berend.Brinkhuis@evatone.comwrote in message | news:bdd9ac20.0401271301.22cdb65e@posting.google.com... | | I am trying to pass multi values into a where clause with an in clause | | in a store procedure to use in a Crystal report. This can change | | depending on the user. Maybe there is another way to pass multi | | values. | | | |
13
2690
by: tekinalp67 | last post by:
hi, i am trying to implement a B+ tree. There is no specification in the implementation so i am using arrays to implement the B+ tree. However, there is a problem that i encountered which is I cannot store the address of an array element in an another array element. it is purpose is reaching the childs. The other thing that i want to mention is that the bucket size of the b+ tree is not specific. It will be determined at the beginning of the...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10213
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9037
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2920
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.