Solved

How to concatenate strings

Posted on 2002-04-15
5
957 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft is moving in-place eDiscovery & hold from ECP to EOP console under Content Search in Search and Investigation Options.  In this post, I will be showing you how to export emails to a PST file using the Content Search Options.
This article shows how to use a free utility called 'Parkdale' to easily test the performance and benchmark any Hard Drive(s) installed in your computer. We also look at RAM Disks and their speed comparisons.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

729 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