Re: Urgent Converting varchar to ntext in SQL

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Sileesh (Sileesh_at_discussions.microsoft.com)
Date: 11/12/04


Date: Thu, 11 Nov 2004 16:35:02 -0800

Hi barker

Thanks for the reply. It works fine now.

But i still have one question.

The DataType is ntext for the Column "Notes" in Database. And i declare a
local variable "LocalNotes" as varchar(8000).

As long as tha data in "Notes" (which is ntext) is less than 8000
charahcters, no prob. But when it has more than 8000 characters there is
every chance of loosing data. Do u know how to declare the local variable
also as ntext so that i don't loose tha data.

I tried declaring the "LocalNotes" as ntext, it says not allowed.

Have any idea

Sileesh

"bruce barker" wrote:

> in the cursor select
>
> select convert(varchar(8000),LocalNotes) as LocalNotes
>
> of course if you did not use a cursor, you could just copy the data with a
> set operation, with a huge performace gain.
>
> -- bruce (sqlwork.com)
>
>
>
>
> "Sileesh" <Sileesh@discussions.microsoft.com> wrote in message
> news:075D1B23-F295-4328-AD4F-22A003122F90@microsoft.com...
> | HI
> |
> | I know this is not the right forum to post this question, but i think
> some
> | one might have a suggestion.
> |
> | I have a Table "Test" with columns
> | Id bigint (PK), Number Varchar(50), Notes ntext. in sql server 2000
> |
> | I ahve a stored procedure in which i am trying to insert the same data as
> | new record with column "Number" changed.
> |
> | So I declared a local variable "Localnotes" as varchar(8000), as ntext is
> | not allowed.
> |
> | Now when i try to get the data from the "TEST"table into a cursor to
> locally
> | decalred variable "Localnotes", it gives me error
> | "Cursor Fetch: Implicit conversion from data type ntext to varchar is not
> | allowed."
> | .
> | Does any one know how to convert "varchar" to "ntext "data type explicitly
> | in sqlserver 2000.
> |
> | Pls help
> | Sileesh
> |
>
>
>



Relevant Pages

  • Re: Cursor and Procedure
    ... I need to truncate those strings to the segments with 200 ... Actually problem is ntext hold> 4000 char. ... DECLARE @deptTriDes ntext ...
    (comp.databases.ms-sqlserver)
  • Re: problem using ntext data type in OPENXML
    ... > I've got problems using ntext data in a stored procedure (SQL-Server ... > declare @Param ntext ... declare ntext variables - see DECLARE in Books Online. ...
    (microsoft.public.sqlserver.xml)
  • why doesnt this query work...
    ... declare @joiningTable varchar ... JournalJoiningTablesTypes left outer join JournalEntryTypes on ... JunctionTableName = @joiningTable) ... The text, ntext, and image data types are invalid in this subquery or ...
    (microsoft.public.sqlserver.programming)
  • Is there a way to transfer ntext data from one table to another? MSSQL2000
    ... Is there a way to transfer ntext data from one table to another? ... DECLARE @DESCRIPTION ntext ... error reported is "The text, ntext, and image data types are invalid ...
    (comp.databases.ms-sqlserver)
  • Re: Passing XML between 2005 and 2000
    ... create proc dbo.GetIDs(@p ntext) ... declare @x xml ...
    (microsoft.public.sqlserver.xml)