Solved

How to concatenate strings

Posted on 2002-04-15
5
931 Views
Last Modified: 2008-03-06
Hello!

I'm working on a program that extracts data from one database to another.
In several places, some text fields have to be concatenated. For instance, There are 6 addresses lines to be stored into 3 lines. This example would be easy, but there are more complicated issues: 9 text lines have to be stored into 4 text fields.
I was thinking about a general stored procedure that could look like this:

ConcatenateFields @AllTheValues, @FieldNumber, @FieldLength, @result

This function should return the substring of @AllTheValues, starting at @FieldLength * @FieldNumber

The problem is that the @AllTheValues parameter could be a string > 255. Also, I thought of declaring as Text, but I'm not allowed to do so, like its not allowed to declare a local variable of type text.

Does anyone have an idea on how to implement such a function? How can I use large strings in a stored procedure? Any ideas?

Thanks.
0
Comment
Question by:ornicar
5 Comments
 
LVL 5

Expert Comment

by:amitpagarwal
ID: 6943046
the best way to handle this would be while extracting data at the first step - use OS string commands to get your results.
0
 
LVL 3

Expert Comment

by:ahoor
ID: 6996907
From Sybase 12.5 you can use bigger varchars... upto 16K if you set the pagesize (serversetting) high enough.
However if you would do this you may want to build a temporary 12.5 server which has 16K pages for this conversion, so you won't have to change any servers you use.
0
 
LVL 10

Expert Comment

by:bret
ID: 7025013
Even with a 2K page size, an ASE 12.5 server can have char/varchar columns up to ~1950 bytes in length.
0
 
LVL 6

Expert Comment

by:ChrisKing
ID: 9947803
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ/No Refund

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

ChrisKing
EE Cleanup Volunteer
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 9990070
PAQed - no points refunded (of 200)

modulo
Community Support Moderator
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
In  today’s increasingly digital world, managed service providers (MSPs) fight for their customers’ attention, looking for ways to make them stay and purchase more services. One way to encourage that behavior is to develop a dependable brand of prod…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now