473,503 Members | 2,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8729
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
19682
by: Berislav Lopac | last post by:
I was lately wandering what would be the advantage of using varchar instead of text column data type in a database (specificall MySQL, but this might also be the case for other databases)? I mean,...
3
118821
by: Nikola | last post by:
Hi all, I have a problem converting datetime to integer (and than back to datetime). Depending whether the time is AM or PM, same date is converted to two different integer representations,...
2
9044
by: Vani Kancherlapalli | last post by:
Hi The maximum length of a nvarchar could be 4000 characters while that of varchar could be 8000. We are trying to use unicode which would require that the datatype for one our fields be...
3
1537
by: kieran | last post by:
Hi, I have a form which is submitting into a sql server db. i have one of the fields set to ntext which says length of 16. when i insert info, it only sumbits about a paragraph and when i pull...
2
3310
by: Sam | last post by:
Hi, What is the maximum character a text type column can contain ? Can't change the length to upper than 16.... What is the bigger ? Varchar(8000) or Text ? Regards
12
3128
by: Frederik Vanderhaeghe | last post by:
Hi, I have a problem converting text to a double. Why doesn't the code work: If Not (txtdocbedrag.Text = "") Then Select Case ddlBedrag.SelectedIndex Case 0 Case 1
0
1714
Krishna Ladwa
by: Krishna Ladwa | last post by:
In Sql Server 2000 Version, I found that no Notification message box appears when converting text column to varchar but the data gets truncated to the given size for the varchar. Whereas it appears...
2
2362
by: itsvineeth209 | last post by:
My task is to create login control without using login control in tools. I shouldnt use sqldatasource or any other. I should use only data sets, data adapters and data readers etc. U had created...
17
2546
by: anojjona | last post by:
Hi, I need to figure out what some code that was maliciously executed against a database does. However, it's in a very strange format. It simply declares a variable and sets it equal to a huge...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4688
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
399
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.