[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to concatenate strings

Posted on 2002-04-15
5
Medium Priority
?
969 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Applications for our next round of the Experts Exchange Scholarship Contest are starting to roll in. It made us wonder what our past winners are up to these days. Here's a look at what four winners experienced with the contest and what they're doing…
Tech giants such as Amazon and Google have sold Alexa and Echo to such an extent that they have become household names. And soon they are expected to be used by commoners in their homes, ordering takeout, picking out a song, answering trivia questio…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month20 days, 12 hours left to enroll

865 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