![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I know this is probably an easy question that has been answered before, but after crawling through google groups for two days now I find I am still stuck. My end aim is to use an external program (using CT-lib) to manipulate results from stored procedures (such as sp_who, sp_spaceused etc). |
#3
| |||
| |||
|
|
Hi, I know this is probably an easy question that has been answered before, but after crawling through google groups for two days now I find I am still stuck. My end aim is to use an external program (using CT-lib) to manipulate results from stored procedures (such as sp_who, sp_spaceused etc). It seems to do this one of the ways I have seen in SQL is like this: -- SET NOCOUNT ON CREATE TABLE #TMPWHO ( FID INT, SPID INT, STATUS CHAR(100), LOGINAME CHAR(100), ORIGNAME CHAR(100), HOSTNAME CHAR(100), BLK INT, DBNAME CHAR(100), CMD CHAR(100), BLKXL INT) INSERT INTO #TMPWHO EXEC sp_who SELECT * FROM #TMPWHO DROP TABLE #TMPWHO go -- I am using ASE 12.5.1 on Windows XP Pro. When I put the above into isql I get: -- Msg 156, Level 15, State 2: Line 14: Incorrect syntax near the keyword 'exec'. -- I am obviously doing something wrong, but I cannot seem to fix it. Can someone please let me know what I am doing wrong, or if there is a better way of achieving what I want, don't be shy ![]() Regards Luke PS: I am relatively new to Sybase ASE and not an experienced DBA. |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Mind you, if your capturing this in an external program, why don't you just execute the procedure and pick up the result set. You don't need to get the proc's result into a temp table first and then select it out. Just execute the proc. It should do the same thing. |
#6
| |||
| |||
|
|
Simon Andrew wrote: Mind you, if your capturing this in an external program, why don't you just execute the procedure and pick up the result set. You don't need to get the proc's result into a temp table first and then select it out. Just execute the proc. It should do the same thing. Thats actually what I tried to do in the first place, but for some reason when I go to do my ct_fetch (after ct_results etc) all I get is my return value as "CS_ROW_FAIL" for a few times (it may even be the number of rows I am expecting) and then I get CS_END_DATA and I have no results to show for it. |
![]() |
| Thread Tools | |
| Display Modes | |
| |