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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Truncation of data
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

118 Posts

Posted - 10/27/2005 :  07:38:19  Show Profile  Reply with Quote
I have the following script

create table tblestimateusage (id_num int IDENTITY(1,1),
est_id varchar(50),
title varchar(200),
flatsize varchar(50),
finishedsize varchar(50),
pages varchar(50),
client_name varchar(150),
process varchar(7000)

insert into tblestimateusage (est_id,title,flatsize,finishedsize,pages, client_name, process) select e.est_id, title, flatsize, finishedsize, pages, client_name, [dbo].[ufn_GetProcesses] ( [est_id] ) from tbltest e
join tblcl c on c.client_id = e.client_id
where est_datetime > '20050901'
select * from tblestimateusage

Which uses the following function

ALTER FUNCTION [dbo].[ufn_GetProcesses] ( @ID INT )

DECLARE @ProcessValue VARCHAR(6000)

SELECT @ProcessValue = ISNULL(@ProcessValue + ', ', '') + [process_name] + ' ' + [process_value]
FROM [dbo].[tblmyprocess]
WHERE [est_id] = @ID

RETURN @ProcessValue


This works fine on some occassions but has a problem when either the line hits 8060 bytes then it bombs out or truncating the string via the function.

How do I allow truncation?

Cybernetic Yak Master

11752 Posts

Posted - 10/27/2005 :  07:59:26  Show Profile  Visit spirit1's Homepage  Reply with Quote
have your process filed srt to varchar 6000 and not 7000.

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

Posting Yak Master

118 Posts

Posted - 10/27/2005 :  08:10:15  Show Profile  Reply with Quote
sorry my example is a little misleading they should be the same.

The problem arises when the function attempts to add byte 7001 to @ProcessValue. Rather than noticing it can't add any more and simply returning a truncated variable it decides to blow up with a warning. I want it to return that truncated string (which I know and understand to be down to the page file) and wanted to know how to make sql server accept this
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000