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
 Transact-SQL (2000)
 Remove 2 returns in a result Text file from a SQL

Author  Topic 

fredong
Yak Posting Veteran

80 Posts

Posted - 2004-01-19 : 11:27:05
I have a SQL statement below that I have the result it into a text format and I need the cursor to stop exactly where the result in the last character.However, what I got was that the cursor would only stop at the 2nd return lines after I hit the right arrow key. Can somebody help .Thanks.



SQL statement
-------------
select
'//STX12//850DABCDEFGTest 850'+char(13)+
'0100NE'+a.PO_No+a.PODate+char(13)+
'05ST ZZ'+char(13)+
'06'+a.ShipTowhsecode+char(13)+
'07'+(a.CompanyName)
from A a, B b
where a.id_num = b.Countrow
Union Select
LTRIM(@string_to_trim)+'17'+AssgnID+'+'+RTRIM(OrderQty)+'EA'+' '+' '+'MG'+char(13)+
'18'+RTRIM(ItemID)
from C
go

--Below is the result test and I need th cusor to stop exactly after the last character of 18TEKTDSDUPH91260 -- if you try to place your cursor after the 0 and move your arrow key it will stop at the 2nd returns.

Results in Text
---------------
//STX12//850ABCDEFGTest 850
0100NE000000000000000004075320031105
05ST ZZ
0655109998
07HIJKLMN
171 +000000000000002EA MG
18DUPH7997A-TEKPROOF
172 +000000000000003EA MG
18DUPH80005-TEKPROOF
173 +0000000000000001EA MG
18DUPH80064-TEKPROOF
174 +0000000000000001EA MG
18DUPH80099-TEKPROOF
175 +0000000000000011EA MG
18TEKTDSDUPH91260



k

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-01-19 : 12:47:54
Do not post your question again just because we haven't come up with a solution yet in the other thread:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=31848

Perhaps you need to reconsider how you are going about this since it isn't working for you.

Tara
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-01-19 : 13:10:14
Been looking at this on another site and got a bit more info from the other thread.
Don't think it's possible (or desirable) from anything that exports directly. You would probably have to remove the last crlf after the export.
I would be really surprised if whatever is processing this doesn't expect the final crlf though.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -