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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 using the REPLACE in osql problems.

Author  Topic 

rgp060374
Starting Member

4 Posts

Posted - 2004-10-25 : 09:41:48
Hi,

WHen running the following sql using osql I get blank lines between the results that is return.

select rtrim(T1.ROW_ID)+'|'+rtrim(T1.CUST_STAT_CD)+'|'+rtrim(T1.NAME)+'|'+rtrim(T1.LOC)
+'|'+REPLACE(rtrim(T2.ADDR),CHAR(13)+CHAR(10), ' ')+'|'+rtrim(T2.COUNTY)+'|'+rtrim(T2.COUNTRY)+'|'+rtrim(T2.CITY)
+'|'+rtrim(T2.ZIPCODE)
from S_ORG_EXT T1
INNER JOIN S_ADDR_ORG T2 on T2.OU_ID = T1.ROW_ID

The issue seems to be caused by the use of REPLACE because the results don't seem to have the gaps when its removed.

Please help me to get rid of the blank rows.

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2004-10-25 : 12:14:07
are you exceeding 80 chars wide on your output? OSQL defaults to 80 cols, and wraps if it is wider.

look at the BOL entry for OSQL, I think there is an option to widen the output. I think it is the -w option if I'm not mistaken.



-ec
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-10-25 : 12:25:42
Yup

usage: osql [-U login id] [-P password]
[-S server] [-H hostname] [-E trusted connection]
[-d use database name] [-l login timeout] [-t query timeout]
[-h headers] [-s colseparator] [-w columnwidth]
[-a packetsize] [-e echo input] [-I Enable Quoted Identifiers]
[-L list servers] [-c cmdend] [-D ODBC DSN name]
[-q "cmdline query"] [-Q "cmdline query" and exit]
[-n remove numbering] [-m errorlevel]
[-r msgs to stderr] [-V severitylevel]
[-i inputfile] [-o outputfile]
[-p print statistics] [-b On error batch abort]
[-X[1] disable commands [and exit with warning]]
[-O use Old ISQL behavior disables the following]
<EOF> batch processing
Auto console width scaling
Wide messages
default errorlevel is -1 vs 1
[-? show syntax summary]

Kristen
Go to Top of Page

rgp060374
Starting Member

4 Posts

Posted - 2004-10-26 : 03:02:40
Yup,

I'm exceeding 80 char but I've used the -w switch to accomodate the additional characters.

When I remove the REPLACE from the SQL all seems to be well except for the linefeeds that I'm trying to remove with the REPLACE.
Go to Top of Page
   

- Advertisement -