Quantcast
Channel: SCN: Message List - SAP Adaptive Server Enterprise (SAP ASE) for Custom Applications
Viewing all articles
Browse latest Browse all 3587

Re: export data using the output command from interactive sql

$
0
0

You are welcome to look out for a third party tool

 

Being a passionate developer, I tend to use the lego blocks provided first !!

 

So while you are looking for the tool,

you can use powerful object called view !

view also allows you projections (set of columns) and selection (set of rows) and rearrange the columns, column names, etc.

 

Both bcp and isql can get data out from a view.

 

As an example :  To get 4 coulmns out of master..syslogins

 

create view v_mysyslogins

as

select

'"' + name + '"' as name,

'"' + convert(varchar(5), suid) + '"' as suid,

'"' + fullname + '"' as fullname,

'"' + convert(varchar(30), crdate, 109) + '"' as crdate

from master..syslogins

go

 

Sample output is :

1> select top 3 * from v_mysyslogins

2> go

name                             suid    fullname                         crdate

-------------------------------- ------- -------------------------------- --------------------------------

"sa"                             "1"     ""                               "Nov 18 2010  4:16:10:886PM"

"probe"                          "2"     ""                               "Nov 18 2010  4:16:35:026PM"

"locke"                          "4"     ""                               ""

 

 

(3 rows affected)

 

And you can use isql or bcp to get data using this view.

 

You can also craft your script(s) to automate creation of this type of views on the fly by providing just the table name.

 

HTH

 

Avinash


Viewing all articles
Browse latest Browse all 3587

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>