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 |
|
tocroi72
Yak Posting Veteran
89 Posts |
Posted - 2006-04-19 : 15:21:13
|
| hi,xp_fixeddrives return 2 set of records. How do i store this result into a table? Thanks |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-04-19 : 15:23:57
|
| CREATE TABLE FixedDrives(drive char(1) NOT NULL, MBFree int NOT NULL)INSERT INTO FixedDrives(drive, MBFree)EXEC master.dbo.xp_fixeddrivesSELECT * FROM FixedDrivesDROP TABLE FixedDrivesTara Kizeraka tduggan |
 |
|
|
tocroi72
Yak Posting Veteran
89 Posts |
Posted - 2006-04-19 : 15:30:53
|
| sorry Tara - i meant the sp_spaceused - not the xp_FixedDrivesthanks for your help |
 |
|
|
druer
Constraint Violating Yak Guru
314 Posts |
Posted - 2006-04-19 : 15:46:31
|
| In general you need to look at peoples suggestions and extrapolate what you are looking for. Tara's suggestion is to create table which has the fields and datatypes that match whatever result set you are dealing with. Then you simply do an INSERT INTO statement, and then use the EXEC statement to run the command you were using. If you learn the concept of extrapolating to fit your needs, you won't have to ask again when you change your command to any one of 10 million other commands in the future. Dalton |
 |
|
|
tocroi72
Yak Posting Veteran
89 Posts |
Posted - 2006-04-19 : 15:53:46
|
| Thanks for your suggestion. I am familiar with the concept- create a table and execute the sp to save the result to a table. In this particular case, the sp result 2 set of result instead of one set of result. I did try what Tara suggested before i asked for helps - i posted the wrong system procedure and that makes you think it is simple - If you run sp_spaceused and pass the table name, then it will only return one set of result, but if you just run sp_spaceused by itself without passing any parameter (object) level , it will return you 2 set of result, then you will see what i meant. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-04-19 : 16:41:24
|
| You could dissect sp_spaceused to get the data that you want, but if all you need is the database_size column, then I'd suggest using sp_databases instead.Tara Kizeraka tduggan |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
|
|
|
|
|
|
|