Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
gregoryagu
Yak Posting Veteran
80 Posts |
Posted - 2008-07-25 : 12:47:14
|
| The following script returns a table. How do I then do a select on the table that is returned so I can see only the info I am looking for?--Display the pages in the database.DBCC TRACEON (3604)Declare @DBID int, @TableID IntSet @DBID = db_id()Set @TableID = object_id('ObjectItemXRef')DBCC ind(@DBID,@TableID , -1)The select statement I would like to execute is:Select * from ___ where PageType = 2Thanks,Greg |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-07-25 : 14:25:41
|
| Do you want that to be dynamic?DBCC traceon(3604) will give result in SQL error logDBCC ind will show all pages used by indexes.I am not sure it is supported in SQL 2000/2005.Or you can put results in temp table . |
 |
|
|
gregoryagu
Yak Posting Veteran
80 Posts |
Posted - 2008-07-25 : 17:41:47
|
| A temp table would be fine; I just don't get how to put the results of a DBCC command into a temp table or table variable.Greg |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-07-25 : 18:26:29
|
| Create #temptable with desired columninsert into #temptable(desired column) exec ('dbcc ind (' + @DBID + '),(' + @TableID + ')')This is just example. You will have to use Dynamic SQL as well. |
 |
|
|
gregoryagu
Yak Posting Veteran
80 Posts |
Posted - 2008-07-28 : 10:17:42
|
| Thanks so much! |
 |
|
|
|
|
|