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
 General SQL Server Forums
 New to SQL Server Programming
 WRITETEXT in SQL

Author  Topic 

Oneandonlyv
Starting Member

13 Posts

Posted - 2011-10-12 : 08:23:16
Hello! I am ultimately trying to create a CSV text file. I am using a SQL base proprietary report design software.

My problem: When the file creates it does not display in segment order. I have CHECK information, which should follow with related INVOICE information. But the file returns the INVOICE data first. My research tells me that it is because WRITETEXT is fully executing the data then writing it. Sort of a last in, first out approach.

Currently I am trying to make the WRITETEXT a SQL statement (fully formatted)that I can call on later. I am having trouble doing this because the data has hyphens. I have tried various things including placing single quotes around the cell refs with no luck. THANKS!!!!!!!!!!!!!

See sample below:

SQL{CELL{DET01}
CELL{DET02}
CELL{DET03}
PAD{TRIM{CELL{TRANENT}},8}
TRIM{CELL{TRANCKDT}}
PAD{TRIM{CELL{TRANVEND}},12}
TRIM{CELL{NEWCKDATE}}
PAD{TRIM{},10}
PAD{TRIM{},10}
PADCHAR{FORMAT{CELL{WCHECKNET},FIXED,2},19,L,0}
CELL{DET04}
CELL{DET05}
PADCHAR{TRIM{CELL{BANKACCT}},35,R,}
PAD{TRIM{},3}
CELL{DET06A}
PAD{CELL{WTRAN},11}
PAD{TRIM{},1}
PAD{TRIM{},35}
PAD{TRIM{},3}
PAD{TRIM{},3}
PAD{TRIM{},11}
PAD{TRIM{},35}
PAD{TRIM{},1}
PAD{TRIM{},1}
PAD{TRIM{},60}
PAD{TRIM{},1}
PADCHAR{CELL{CEOID},15,R,}
PAD{TRIM{},160}

CHR{CRLF}

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-10-12 : 09:10:49
This is a forum for ms sql server...if you have problems with 3rd party vendors or software providers you should seek help with them instead.

- Lumbago
My blog-> http://thefirstsql.com/2011/07/08/how-to-find-gaps-in-identity-columns-at-the-speed-of-light/
Go to Top of Page

Oneandonlyv
Starting Member

13 Posts

Posted - 2011-10-12 : 09:25:47
Lumbago - I am looking for help with a SQL stmt that format the data I am pulling as text (since it contains some special characters).
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-10-12 : 09:32:54
So what does the sql statement look like?

- Lumbago
My blog-> http://thefirstsql.com/2011/07/08/how-to-find-gaps-in-identity-columns-at-the-speed-of-light/
Go to Top of Page

Oneandonlyv
Starting Member

13 Posts

Posted - 2011-10-12 : 10:08:44
I was trying to take the cell/formatted references in the above and make it a SQL stmt. For example:

SQL{SELECT 'CELL{DET01}', 'CELL{DET02}','CELL{DET03}',PAD{TRIM{'CELL{TRANCKDT}'},8}}

Because it is a cell w/I a report you use SQL{} to write the stmt, inserting the stmt within the brackets. The above is not working, and without the single quotes it errors because the date (TRANCKDT) displays as 10-12-2011 (which is formatted for the CSV file).

I hope this makes sense. Thank you for your help.
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-10-13 : 01:46:09
quote:
I hope this makes sense.
I'm really sorry but to me it isn't. You should contact the support of this proprietary report design tool you are using instead or see if there are any forums related to this tool. We can help you with just about anything that has directly to do with sql server but when it comes to 3rd party apps/tools you might get lucky but we have a tendency to come short. The code you are posting is not valid sql that can be run in sql server management studio, hence there is not much I/we can do. Sorry...

- Lumbago
My blog-> http://thefirstsql.com/2011/07/08/how-to-find-gaps-in-identity-columns-at-the-speed-of-light/
Go to Top of Page

Oneandonlyv
Starting Member

13 Posts

Posted - 2011-10-13 : 08:03:38
Lumbago, I understand. Thanks for taking the time to respond.
Go to Top of Page
   

- Advertisement -