Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 problem with ntext parameter

Author  Topic 

zouzou
Starting Member

3 Posts

Posted - 2004-08-27 : 08:32:50
1- I cann't convert a ntext parameter to nvarchar .
2- How can i concatane two ntext parameters?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-08-27 : 08:42:22
select cast(var1 as nvarchar) + cast(var2 as nvarchar)
from MyTable

but why would you want to convert a ntext to nvarchar? nvarchar will only take 4000 chars and it will truncate you text field if its longer.

Go with the flow & have fun! Else fight the flow :)
Go to Top of Page

zouzou
Starting Member

3 Posts

Posted - 2004-08-27 : 08:59:04
i want to convert a parameter ntext to nvarchar because i can concatane to nvarchar parameters param1 + param2 but i can't do this if i have 2 ntext parameters.
But i try to convert nvarchar to ntext AND ntext to nvarchar but it is impossible.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-08-27 : 09:03:57
this is how you can convert it.
convert(nvarchar(4000), textCol) or
cast(textCol as nvarchar(4000))

Go with the flow & have fun! Else fight the flow :)
Go to Top of Page

zouzou
Starting Member

3 Posts

Posted - 2004-08-27 : 09:18:44
But the pb is my parmater ntext can pass 4000!!
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-08-27 : 09:26:30
well i u don't need unicode support you can use varchar(8000) or split it:

select SUBSTRING (textcol, 0, 4000) + SUBSTRING (textcol, 4000, 4000) + SUBSTRING (textcol, 8000, 4000) + ...

Go with the flow & have fun! Else fight the flow :)
Go to Top of Page
   

- Advertisement -