SQL2K
I have 2 columns, one is numeric and 2nd is TEXT or memo column.
I have been trying for the last few days with no success.
Here is the statement that I have been using:
UPDATE MYTABLE
SET MYMEMO = STR(PERCENTAGE,7)+' '+MYMEMO
When I run it, I get data type error.
I would appreciate if someone please help me here.
Thx
Hi,
You need to convert the TEXT data type to Varchar for using normal updates.
UPDATE MYTABLE
SET MYMEMO = ltrim(rtrim(convert(char,PERCENTAGE,7)))+'
'+ltrim(rtrim(convert(varchar(8000),MYMEMO)))
Thanks
Hari
SQL Server MVP
"Mac" wrote:
> SQL2K
> --
>
> I have 2 columns, one is numeric and 2nd is TEXT or memo column.
> I have been trying for the last few days with no success.
> Here is the statement that I have been using:
>
> UPDATE MYTABLE
> SET MYMEMO = STR(PERCENTAGE,7)+' '+MYMEMO
> When I run it, I get data type error.
> I would appreciate if someone please help me here.
> Thx
>
>
|||Hi,
Feedback below..
SELECT MAX(DATALENGTH(mymemo)) FROM mytable
-- If the above is < 8000
UPDATE MYTABLE
SET MYMEMO = RTRIM(LTRIM(STR(PERCENTAGE,7)))+' '+
CONVERT(VARCHAR(8000), MYMEMO)
GO
-- If it isn't < 8000 lookup UPDATETEXT clause in SQL Server BOL
Greg
Showing posts with label numeric. Show all posts
Showing posts with label numeric. Show all posts
Friday, February 24, 2012
How to add 2 columns together
SQL2K
--
I have 2 columns, one is numeric and 2nd is TEXT or memo column.
I have been trying for the last few days with no success.
Here is the statement that I have been using:
UPDATE MYTABLE
SET MYMEMO = STR(PERCENTAGE,7)+' '+MYMEMO
When I run it, I get data type error.
I would appreciate if someone please help me here.
ThxHi,
You need to convert the TEXT data type to Varchar for using normal updates.
UPDATE MYTABLE
SET MYMEMO = ltrim(rtrim(convert(char,PERCENTAGE,7)))+'
'+ltrim(rtrim(convert(varchar(8000),MYMEMO)))
Thanks
Hari
SQL Server MVP
"Mac" wrote:
> SQL2K
> --
>
> I have 2 columns, one is numeric and 2nd is TEXT or memo column.
> I have been trying for the last few days with no success.
> Here is the statement that I have been using:
>
> UPDATE MYTABLE
> SET MYMEMO = STR(PERCENTAGE,7)+' '+MYMEMO
> When I run it, I get data type error.
> I would appreciate if someone please help me here.
> Thx
>
>|||Hi,
Feedback below..
SELECT MAX(DATALENGTH(mymemo)) FROM mytable
-- If the above is < 8000
UPDATE MYTABLE
SET MYMEMO = RTRIM(LTRIM(STR(PERCENTAGE,7)))+' '+
CONVERT(VARCHAR(8000), MYMEMO)
GO
-- If it isn't < 8000 lookup UPDATETEXT clause in SQL Server BOL
Greg
--
I have 2 columns, one is numeric and 2nd is TEXT or memo column.
I have been trying for the last few days with no success.
Here is the statement that I have been using:
UPDATE MYTABLE
SET MYMEMO = STR(PERCENTAGE,7)+' '+MYMEMO
When I run it, I get data type error.
I would appreciate if someone please help me here.
ThxHi,
You need to convert the TEXT data type to Varchar for using normal updates.
UPDATE MYTABLE
SET MYMEMO = ltrim(rtrim(convert(char,PERCENTAGE,7)))+'
'+ltrim(rtrim(convert(varchar(8000),MYMEMO)))
Thanks
Hari
SQL Server MVP
"Mac" wrote:
> SQL2K
> --
>
> I have 2 columns, one is numeric and 2nd is TEXT or memo column.
> I have been trying for the last few days with no success.
> Here is the statement that I have been using:
>
> UPDATE MYTABLE
> SET MYMEMO = STR(PERCENTAGE,7)+' '+MYMEMO
> When I run it, I get data type error.
> I would appreciate if someone please help me here.
> Thx
>
>|||Hi,
Feedback below..
SELECT MAX(DATALENGTH(mymemo)) FROM mytable
-- If the above is < 8000
UPDATE MYTABLE
SET MYMEMO = RTRIM(LTRIM(STR(PERCENTAGE,7)))+' '+
CONVERT(VARCHAR(8000), MYMEMO)
GO
-- If it isn't < 8000 lookup UPDATETEXT clause in SQL Server BOL
Greg
How to add 2 columns together
SQL2K
---
---
I have 2 columns, one is numeric and 2nd is TEXT or memo column.
I have been trying for the last few days with no success.
Here is the statement that I have been using:
UPDATE MYTABLE
SET MYMEMO = STR(PERCENTAGE,7)+' '+MYMEMO
When I run it, I get data type error.
I would appreciate if someone please help me here.
ThxHi,
Feedback below..
SELECT MAX(DATALENGTH(mymemo)) FROM mytable
-- If the above is < 8000
UPDATE MYTABLE
SET MYMEMO = RTRIM(LTRIM(STR(PERCENTAGE,7)))+' '+
CONVERT(VARCHAR(8000), MYMEMO)
GO
-- If it isn't < 8000 lookup UPDATETEXT clause in SQL Server BOL
Greg
How to add 2 columns together
SQL2K
--
I have 2 columns, one is numeric and 2nd is TEXT or memo column.
I have been trying for the last few days with no success.
Here is the statement that I have been using:
UPDATE MYTABLE
SET MYMEMO = STR(PERCENTAGE,7)+' '+MYMEMO
When I run it, I get data type error.
I would appreciate if someone please help me here.
ThxHi,
You need to convert the TEXT data type to Varchar for using normal updates.
UPDATE MYTABLE
SET MYMEMO = ltrim(rtrim(convert(char,PERCENTAGE,7)))
+'
'+ltrim(rtrim(convert(varchar(8000),MYME
MO)))
Thanks
Hari
SQL Server MVP
"Mac" wrote:
> SQL2K
> --
>
> I have 2 columns, one is numeric and 2nd is TEXT or memo column.
> I have been trying for the last few days with no success.
> Here is the statement that I have been using:
>
> UPDATE MYTABLE
> SET MYMEMO = STR(PERCENTAGE,7)+' '+MYMEMO
> When I run it, I get data type error.
> I would appreciate if someone please help me here.
> Thx
>
>|||Hi,
Feedback below..
SELECT MAX(DATALENGTH(mymemo)) FROM mytable
-- If the above is < 8000
UPDATE MYTABLE
SET MYMEMO = RTRIM(LTRIM(STR(PERCENTAGE,7)))+' '+
CONVERT(VARCHAR(8000), MYMEMO)
GO
-- If it isn't < 8000 lookup UPDATETEXT clause in SQL Server BOL
Greg
--
I have 2 columns, one is numeric and 2nd is TEXT or memo column.
I have been trying for the last few days with no success.
Here is the statement that I have been using:
UPDATE MYTABLE
SET MYMEMO = STR(PERCENTAGE,7)+' '+MYMEMO
When I run it, I get data type error.
I would appreciate if someone please help me here.
ThxHi,
You need to convert the TEXT data type to Varchar for using normal updates.
UPDATE MYTABLE
SET MYMEMO = ltrim(rtrim(convert(char,PERCENTAGE,7)))
+'
'+ltrim(rtrim(convert(varchar(8000),MYME
MO)))
Thanks
Hari
SQL Server MVP
"Mac" wrote:
> SQL2K
> --
>
> I have 2 columns, one is numeric and 2nd is TEXT or memo column.
> I have been trying for the last few days with no success.
> Here is the statement that I have been using:
>
> UPDATE MYTABLE
> SET MYMEMO = STR(PERCENTAGE,7)+' '+MYMEMO
> When I run it, I get data type error.
> I would appreciate if someone please help me here.
> Thx
>
>|||Hi,
Feedback below..
SELECT MAX(DATALENGTH(mymemo)) FROM mytable
-- If the above is < 8000
UPDATE MYTABLE
SET MYMEMO = RTRIM(LTRIM(STR(PERCENTAGE,7)))+' '+
CONVERT(VARCHAR(8000), MYMEMO)
GO
-- If it isn't < 8000 lookup UPDATETEXT clause in SQL Server BOL
Greg
Subscribe to:
Posts (Atom)