Urgent Converting varchar to ntext in SQL

G

Guest

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
 
B

bruce barker

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)




| 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
|
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top