Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / July 2008

Tip: Looking for answers? Try searching our database.

Concatenating variables of type "text" -- please help!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
almurph@altavista.com - 30 Jul 2008 17:13 GMT
Hi,

    Hope you can help me with this. I am really stuck. I need to
concatenate 2 variables of type text (or ntext) in SQL Server 2005.
    Problem is though - I don't know how to do it.

    Can anyone help me please? Would greatly appreciate any assistance/
suggestions/help that you may be able to offer.

Thanks,
Al.
Tom Moreau - 30 Jul 2008 17:20 GMT
Why not use varchar(max) or nvarchar(max)?

Signature

  Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON   Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau

Hi,

Hope you can help me with this. I am really stuck. I need to
concatenate 2 variables of type text (or ntext) in SQL Server 2005.
Problem is though - I don't know how to do it.

Can anyone help me please? Would greatly appreciate any assistance/
suggestions/help that you may be able to offer.

Thanks,
Al.
almurph@altavista.com - 31 Jul 2008 10:01 GMT
> Why not use varchar(max) or nvarchar(max)?
>
[quoted text clipped - 20 lines]
> Thanks,
> Al.

Hi Tom,

   The strings are longer than the max amount allowed by these
types...
Tom Moreau - 31 Jul 2008 12:25 GMT
The max length of nvarchar(max), varchar(max), ntext, and text are all 2GB.
I don't understand what you are saying.  Do you want a result that is
greater than 2GB in length?

Signature

  Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON   Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau

On Jul 30, 5:20 pm, "Tom Moreau" <t...@dont.spam.me.cips.ca> wrote:
> Why not use varchar(max) or nvarchar(max)?
>
[quoted text clipped - 20 lines]
> Thanks,
> Al.

Hi Tom,

   The strings are longer than the max amount allowed by these
types...
Aaron Bertrand [SQL Server MVP] - 31 Jul 2008 13:17 GMT
> I don't understand what you are saying.  Do you want a result that is
> greater than 2GB in length?

And even in that case, how could TEXT have helped?
Tom Moreau - 31 Jul 2008 13:23 GMT
Yep!

Signature

  Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON   Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau

> I don't understand what you are saying.  Do you want a result that is
> greater than 2GB in length?

And even in that case, how could TEXT have helped?
Aaron Bertrand [SQL Server MVP] - 31 Jul 2008 12:44 GMT
>> The strings are longer than the max amount allowed by these
types...

Huh?  Did you even try it?  Have you looked at the documentation on the MAX
types at all?

TEXT supports 2GB; VARCHAR(MAX) supports 2GB.

NTEXT supports 1GB; NVARCHAR(MAX) supports 1GB.

What is the difference?  TEXT/NTEXT are much more difficult to work with...
you can't declare them as local variables, you can't concatenate them, they
don't support common string functions such as REPLACE(), LEFT(), etc... oh
and they're also on the deprecated list.
Tom Moreau - 31 Jul 2008 13:03 GMT
"NTEXT supports 1GB; NVARCHAR(MAX) supports 1GB."  Technically, they support
2 gigaBYTES but - since they are 2 bytes per char - they support 2
gigaCHARACTERS.

Signature

  Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON   Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau

>> The strings are longer than the max amount allowed by these
types...

Huh?  Did you even try it?  Have you looked at the documentation on the MAX
types at all?

TEXT supports 2GB; VARCHAR(MAX) supports 2GB.

NTEXT supports 1GB; NVARCHAR(MAX) supports 1GB.

What is the difference?  TEXT/NTEXT are much more difficult to work with...
you can't declare them as local variables, you can't concatenate them, they
don't support common string functions such as REPLACE(), LEFT(), etc... oh
and they're also on the deprecated list.
Aaron Bertrand [SQL Server MVP] - 31 Jul 2008 13:16 GMT
> "NTEXT supports 1GB; NVARCHAR(MAX) supports 1GB."  Technically, they
> support
> 2 gigaBYTES but - since they are 2 bytes per char - they support 2
> gigaCHARACTERS.

Yes, I meant billions of characters, not billions of bytes.  The typing part
is just force of habit.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.