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.
| Author |
Topic |
|
benkubs
Starting Member
3 Posts |
Posted - 2002-07-23 : 11:44:24
|
| I have a database stored procedure that I want to concatenate two ntext values and return one record with both values. I tried using the plus operator but got the message that is was not supported. Any other ideas? |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-07-23 : 11:48:30
|
| You'd have to use the WRITETEXT or UPDATETEXT commands to accomplish that. They are both documented in Books Online and include code examples. |
 |
|
|
benkubs
Starting Member
3 Posts |
Posted - 2002-07-23 : 14:20:04
|
| I looked at the information included in the books and I see how i could concatenate fields in an insert or update but I need to do it for a record that is returned to my application from the database. I couldn't see how that would work. |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-07-23 : 14:37:55
|
| You'd have to create a temp table and concatenate them there, then return the results of the temp table. Or, you could combine them on the application side using regular string functions (col1 & col2 in VB, for example)BTW, unless you absolutely have to deal with international characters in multiple character sets, you don't need to use ntext or nvarchar. You'll get more usuable space with text/varchar. |
 |
|
|
benkubs
Starting Member
3 Posts |
Posted - 2002-07-23 : 15:55:45
|
| Thanks for the info about ntext vs. text. This table is the result of upsizing an Access 2000 database so I can change the fields. Is it possible to do the concatenation with a text field or will I still have to use a temp table? |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-07-23 : 16:13:56
|
| You'll have to use a table of some kind, because you can't modify a text/ntext variable, and UPDATETEXT doesn't work on text variables anyway. Therefore the concatenated result will have to end up in a table and then SELECTed from that table. |
 |
|
|
joshb
Yak Posting Veteran
52 Posts |
Posted - 2002-07-23 : 16:14:15
|
| Adding to what Rob said, unless you need more than 8000 characters go with a varchar, I find them much easier to work with than text. I don't think you can directly concatenate text.Josh |
 |
|
|
|
|
|