473,770 Members | 1,645 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 8776
in the cursor select

select convert(varchar (8000),LocalNot es) 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*****@discus sions.microsoft .com> wrote in message
news:07******** *************** ***********@mic rosoft.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),LocalNot es) 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*****@discus sions.microsoft .com> wrote in message
news:07******** *************** ***********@mic rosoft.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
19712
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, both of them are variable length, both can be indexed, and text can hold a lot more data... I'm just looking for some other opinions on the subjects. Berislav
3
118838
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, which holds as true on reversal back to datetime. AM Example:
2
9069
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 converted from varchar to nvarchar. But looks like this would result in loss of existing data. Is there a way to do this without loss of data?
3
1550
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 this back using analyser it amounts to a byte count of 256 bytes. i thought you could submit pages of info using ntext?? i had been trying to use varchar with a length of 7000, but for some reason only info on the one line is submitted. if...
2
3332
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
3190
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
1742
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 when you convert the varchar column to text column. Do this through Enterprise Manager Console Create a New table with a column as varchar datatype from Enterprise Manager  table created  Open the table and add one row  Successfully added the...
2
2377
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 table login with fields username(varchar(50)), password(varchar(50)), firstname(varchar(50)), lastname(varchar(50)). U had to display username , first name, last name in default.aspx page after login. One more condition is that, if user fails login...
17
2572
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 binary thing (seems to be some sort of compiled code) cast as nvarchar. It then executes this variable. Is there any way to decipher or decompile this code? Does anyone have information either on what SQL Server does when it's asked to execute...
0
9595
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9432
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10232
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9873
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
3974
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 we have to send another system
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2822
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.