Solved

How to concatenate strings

Posted on 2002-04-15
5
951 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Facebook has became the #1 social media platform. People share many funny videos there, yet you don't know how to download them? Now you can download Videos from Facebook in just 3 simple steps.
This article was originally published on Monitis Blog, you can check it  here . If you have responsibility for software in production, I bet you’d like to know more about it. I don’t mean that you’d like an extra peek into the bowels of the sour…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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