dickiebird
Programmer
Hi Guys
I have 1 or 2 little problems running this script - hope you can help :-
isql -Usa -Psa <<END
set nocount on
set rowcount 0
select ltrim(rtrim(substring(agent_code, 2, 9))),
"|",
agent_type,
"|",
short_na
"|",
sales_centre_code,
"|",
sl2.description,
"|",
sl3.description,
"|",
sl4.description,
"|",
postal_add1,
"|",
postal_add2,
"|",
postal_add3,
"|",
postal_add4,
"|",
isnull(postal_add5, " ",
"|",
isnull(agent_zip," "
from agent a, sl2, sl3, sl4
where status = 1
and sl4.sl4 = a.sl4
and sl4.sl3 = sl3.sl3
and sl3.sl2 = sl2.sl2
go
END
It runs fine - gets all I want, but......
I have the column headings and underlines once at the top - which I don't want. The output is also split into 7 lines per agent - there's NL/CR(0D 0A) around col 80 or earlier - I would like 1 row of 402 chars, per agent.
Sample output :
07949 | B | HSBC BK BRASIL NITEROI CANX 22 |
LATIN AMERICA | SAO PAULO | CLOSED AGENTS-BRAZIL |
HSBC BANK BRASIL S.A. |
RUA GALVAO, 148 - LJ. 112 - BLOCO I |
24421-030 - NITEROI - RJ |
BRAZIL |
| 24421 030
I could tidy up in the script afterwards with some shell commands, but it'd be 'better' to know how to create clean output from the SQL first.
Anyone any thoughts ??
TIA ;-) Dickie Bird
db@dickiebird.freeserve.co.uk
I have 1 or 2 little problems running this script - hope you can help :-
isql -Usa -Psa <<END
set nocount on
set rowcount 0
select ltrim(rtrim(substring(agent_code, 2, 9))),
"|",
agent_type,
"|",
short_na
"|",
sales_centre_code,
"|",
sl2.description,
"|",
sl3.description,
"|",
sl4.description,
"|",
postal_add1,
"|",
postal_add2,
"|",
postal_add3,
"|",
postal_add4,
"|",
isnull(postal_add5, " ",
"|",
isnull(agent_zip," "
from agent a, sl2, sl3, sl4
where status = 1
and sl4.sl4 = a.sl4
and sl4.sl3 = sl3.sl3
and sl3.sl2 = sl2.sl2
go
END
It runs fine - gets all I want, but......
I have the column headings and underlines once at the top - which I don't want. The output is also split into 7 lines per agent - there's NL/CR(0D 0A) around col 80 or earlier - I would like 1 row of 402 chars, per agent.
Sample output :
07949 | B | HSBC BK BRASIL NITEROI CANX 22 |
LATIN AMERICA | SAO PAULO | CLOSED AGENTS-BRAZIL |
HSBC BANK BRASIL S.A. |
RUA GALVAO, 148 - LJ. 112 - BLOCO I |
24421-030 - NITEROI - RJ |
BRAZIL |
| 24421 030
I could tidy up in the script afterwards with some shell commands, but it'd be 'better' to know how to create clean output from the SQL first.
Anyone any thoughts ??
TIA ;-) Dickie Bird
db@dickiebird.freeserve.co.uk