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 2005 Forums
 Transact-SQL (2005)
 How to Convert varchar into Text?

Author  Topic 

msv
Starting Member

9 Posts

Posted - 2009-09-11 : 15:28:05
I have a table which has a field with the character type TEXT

and I am trying to insert a VARCHAR into the TEXT field.. how do i convert that Varchar to insert into a TEXT field???

Example
@ERror varchar(50)

select @error = Field_1
from table a
where abc = bcd

insert into B(msg)
values (@error)

i am getting an error

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2009-09-11 : 16:03:30
I believe that there is an implicit conversion from varchar to text but you could always use the CAST or CONVERT functions. What error did you receive when you tried to perfrom your INSERT?

=======================================
Men build too many walls and not enough bridges. -Isaac Newton, philosopher and mathematician (1642-1727)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-09-13 : 13:49:49
why use TEXT? its deprecated in sql 2005. Its better to use varchar(max) instead
Go to Top of Page
   

- Advertisement -