469,623 Members | 878 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

Urgent Converting varchar to ntext in SQL

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

Nov 18 '05 #1
2 8172
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" <Si*****@discussions.microsoft.com> wrote in message
news:07**********************************@microsof t.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
|
Nov 18 '05 #2
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" <Si*****@discussions.microsoft.com> wrote in message
news:07**********************************@microsof t.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
|

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Berislav Lopac | last post: by
2 posts views Thread by Vani Kancherlapalli | last post: by
3 posts views Thread by kieran | last post: by
2 posts views Thread by Sam | last post: by
12 posts views Thread by Frederik Vanderhaeghe | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.