Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

HELP! - 8060 limit/select statement

 
   Database Forums (Home) -> Data Warehouse RSS
Next:  Cluster Network Name  
Author Message
segis bata

External


Since: May 01, 2006
Posts: 9



(Msg. 1) Posted: Thu Feb 21, 2008 10:40 pm
Post subject: HELP! - 8060 limit/select statement
Archived from groups: microsoft>public>sqlserver>datawarehouse, others (more info?)

Hello all,

I want to know if it's possible to make a select statement that brings only
the records with a number of bytes of less than 8060

so, imagine I have a table with 10 records, and two of those ten records
have more than 8060 bytes, so, if I do this:

select a, b, c, d from tableX
where (len(a)+len(b)+len(c)+len(d) < 8060)

it will only bring 8 records, not 10

I tried this approach and it doesn't work, so, my question is, is there a
way (similar to this) using a select statement to limit the results to those
records with less than 8060 bytes, so I will never get the error?

Thanks again for all your help!,
SB-R

 >> Stay informed about: HELP! - 8060 limit/select statement 
Back to top
Login to vote
segis bata

External


Since: May 01, 2006
Posts: 9



(Msg. 2) Posted: Thu Feb 21, 2008 10:43 pm
Post subject: Re: HELP! - 8060 limit/select statement [Login to view extended thread Info.]
Archived from groups: microsoft>public>sqlserver>datawarehouse, others (more info?)

BTW, I'm using SQL Server 2000

Thanks again...


"segis bata" wrote in message

> Hello all,
>
> I want to know if it's possible to make a select statement that brings
> only the records with a number of bytes of less than 8060
>
> so, imagine I have a table with 10 records, and two of those ten records
> have more than 8060 bytes, so, if I do this:
>
> select a, b, c, d from tableX
> where (len(a)+len(b)+len(c)+len(d) < 8060)
>
> it will only bring 8 records, not 10
>
> I tried this approach and it doesn't work, so, my question is, is there a
> way (similar to this) using a select statement to limit the results to
> those records with less than 8060 bytes, so I will never get the error?
>
> Thanks again for all your help!,
> SB-R

 >> Stay informed about: HELP! - 8060 limit/select statement 
Back to top
Login to vote
Balaji

External


Since: Feb 21, 2008
Posts: 5



(Msg. 3) Posted: Thu Feb 21, 2008 10:43 pm
Post subject: Re: HELP! - 8060 limit/select statement [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Feb 22, 8:43 am, "segis bata" wrote:
> BTW, I'm using SQL Server 2000
>
> Thanks again...
>
> "segis bata" wrote in message
>
>
>
>
>
> > Hello all,
>
> > I want to know if it's possible to make a select statement that brings
> > only the records with a number of bytes of less than 8060
>
> > so, imagine I have a table with 10 records, and two of those ten records
> > have more than 8060 bytes, so, if I do this:
>
> > select a, b, c, d from tableX
> > where (len(a)+len(b)+len(c)+len(d) < 8060)
>
> > it will only bring 8 records, not 10
>
> > I tried this approach and it doesn't work, so, my question is, is there a
> > way (similar to this) using a select statement to limit the results to
> > those records with less than 8060 bytes, so I will never get the error?
>
> > Thanks again for all your help!,
> > SB-R- Hide quoted text -
>
> - Show quoted text -

Dear Segis,

It is not possible to trim the record size using a where predicate. If
you are using table which has record length more than 8060 bytes then
it should be having varchar column. If so...on the varchar column use
substring function to trim the data above 8060 bytes. Hope this
suggestion helps.

Regards
Balaji
 >> Stay informed about: HELP! - 8060 limit/select statement 
Back to top
Login to vote
"Roy Harvey

External


Since: Sep 24, 2007
Posts: 167



(Msg. 4) Posted: Fri Feb 22, 2008 8:06 am
Post subject: Re: HELP! - 8060 limit/select statement [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

The LEN() function returns the number of characters, not the number of
bytes. DATALENGTH() returns the number of bytes. If you have any
NVARCHAR columns, which use two bytes per character, you need to use
DATALENGTH().

Also note that there is overhead to the row that is not captured with
the expression you have. Part of that is two bytes for each varying
length column.

Roy Harvey
Beacon Falls, CT

On Thu, 21 Feb 2008 22:43:49 -0500, "segis bata"
wrote:

>BTW, I'm using SQL Server 2000
>
>Thanks again...
>
>
>"segis bata" wrote in message
>
>> Hello all,
>>
>> I want to know if it's possible to make a select statement that brings
>> only the records with a number of bytes of less than 8060
>>
>> so, imagine I have a table with 10 records, and two of those ten records
>> have more than 8060 bytes, so, if I do this:
>>
>> select a, b, c, d from tableX
>> where (len(a)+len(b)+len(c)+len(d) < 8060)
>>
>> it will only bring 8 records, not 10
>>
>> I tried this approach and it doesn't work, so, my question is, is there a
>> way (similar to this) using a select statement to limit the results to
>> those records with less than 8060 bytes, so I will never get the error?
>>
>> Thanks again for all your help!,
>> SB-R
>
 >> Stay informed about: HELP! - 8060 limit/select statement 
Back to top
Login to vote
Display posts from previous:   
   Database Forums (Home) -> Data Warehouse All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]