printing the ISQL result set

printing the ISQL result set

Post by Marty D. Bertra » Thu, 15 Oct 1998 04:00:00



I am currently looking for a way to create a ascii text
file from the result set with ISQL/w commands either within
the query script or from inside a database procedure.

Oracle has this ability using 'spool filename'

Help......So far I have not had any luck

 
 
 

printing the ISQL result set

Post by Wayne Snyde » Thu, 15 Oct 1998 04:00:00


Run isql (the command line version) and redirect the output to a file

isql -U.. -P.. -S... >>c:\myoutpufile.txt

that should do it....

--
Wayne Snyder
MCSE, MCT, CSPDBA
IKON Technology Solutions

 
 
 

printing the ISQL result set

Post by Neil Pik » Fri, 16 Oct 1998 04:00:00


Marty,

Quote:> I am currently looking for a way to create a ascii text
> file from the result set with ISQL/w commands either within
> the query script or from inside a database procedure.

> Oracle has this ability using 'spool filename'

Q.      How can I output records/messages to a flat file from inside a
SQL Server TSQL script/stored-procedure/trigger?
(v1.2   14.10.1998)

A.  SQL Server doesn't have a handy SPOOL command like Oracle does, but
there are a number of ways of doing what you want.

1.  Use xp_cmdshell and the ECHO command.  Use the > or >> redirection
symbols to either create or append to a file.

2.  Put the information you want into a table (note this can't be an
ordinary temporary table, but it can be a global temporary table) and
then bcp it out to a file via xp_cmdshell.
    xp_cmdshell "bcp <dbname>..<tablename> out c:\file.fil -Usa
-P<password> -c"

3.  Write your own extended stored procedure.  As this is a C program
it can use standard file access commands to achieve whatever you want.

4.  Run the select through ISQL via xp_cmdshell and use the -o
parameter to output the results to a file.  This example uses the -E
parameter to avoild hard-coding a userid.




 Neil Pike MVP/MCSE
 Protech Computing Ltd
 (Please post ALL replies to the newsgroup only unless indicated
otherwise)

 
 
 

1. OBDB Result size <> ISQL Result Set

I am having a stored procedure return a result set of 6 rows when called
from ISQL or Enterprise Manager, but the result set appears to have 7
rows when called from Visual Interdev or ASP. The SP is doing some
fairly wierd (but not extremely wierd) stuff, but the result set itself
is tame -- 6 columns, no text fields.

Any Ideas?
-best-darr-
________________________________
Darren Gilroy - Consonus Inc.
Sr. Developer

2. Visual Fox Pro/Oracle Developer Needed!

3. Open Server result sets not displayed properly in isql

4. sp_addlogin and sp_addrolemember

5. Help: ISQL/W 6.5 vs ISQL/W 7.0 and different results

6. Transaction Log file moves

7. Result Sets vs copying result sets into memory.

8. US-MA-SENIOR PROGRAMMER ANALYST

9. How to print oot the multiple result set ?

10. How to print/redirect sql query/stored proceudre result sets to a TEXT file

11. IDC results inconsistent with ISQL results!

12. print a decision cude result set

13. Comparing Result Set to Result Table