Append Text Data Type

  • Hi,

    I want to append two TEXT data types.

    example :

    This is a query in one of my procedure.

    DECLARE @txt1 TEXT

    DECLARE @txt2 TEXT

    SET @txt1 = 'A'

    SET @txt2 = 'B'

    Issue : I tried to append using all the three following query but it threw me a common error => Operand data type text is invalid for add operator.

    SELECT @txt1 + @txt2

    PRINT @txt1 + @txt2

    SET @txt1 = @txt1 + @txt2

    Please help. Thanks.

    "I Love Walking In The Rain So No One Can See Me Crying ! " ~ Charlie Chaplin

  • Text is a binary datatype.

    For strings the datatypes are

    CHAR

    NCHAR

    VARCHAR

    NVARCHAR

    Try looking up the datatypes and how to use them in BOL

  • Yes, i know TEXT is a binary datatype. But i need to use it as a string datatype.

    My issue is, i need to export datas in a table into a notepad. So i prefered TEXT format rather to VARCHAR and NVARCHAR as they are limited to 8000 and 4000 respectively. My table records an grow to any size but does not exceeds a limit 100KB.

    So please help me out in this issue. :unsure:

    "I Love Walking In The Rain So No One Can See Me Crying ! " ~ Charlie Chaplin

  • Are you using SQL Server 2005? If so, do as Andrew suggested and read up on the datatypes. VARCHAR(MAX) in 2K5 can hold up to 2GB of data. TEXT is being deprecated, so it might be an idea to get used to the new types now.

  • Good to know.....:)

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply