April 4, 2006 at 4:04 pm
I saw that in BOL, but I must have been brain-dead thinking this was pulling in all the text within the SP into one long string... Either way, I am still getting the same exact error...
I wasn't born stupid - I had to study.
April 4, 2006 at 4:10 pm
But it works!
Any of these scripts does not fail on any of servers I can access.
Try to find out what's wrong with your server.
Do some test exersises like this:
SELECT MAX(LEN(TEXT)) from syscomments
Try to lacate the reason of the error.
P.S. /1024.0 will give you more accurate result. After you have your Server fixed, of course.
_____________
Code for TallyGenerator
April 4, 2006 at 4:17 pm
It is 4,000. But I still get the error I have been posting, (along with the exact code I run) when I try and do this...
I will check further tomorrow.
Thanks!
I wasn't born stupid - I had to study.
April 4, 2006 at 4:42 pm
Sorry for the delay Yes I goofed when writing the post but it si easy to fix:
select object_name(id) n, sum(datalengh(text)) char_cnt
from syscomments
group by object_name(id)
order by char_cnt desc
I tested it by generating
select replicate('*',8000) several times and got character values over 45000 .. yes fourty five thousand!!!
* Noel
April 4, 2006 at 4:45 pm
sql 2k - sp4 - get the exact same error msg as farrell does..
**ASCII stupid question, get a stupid ANSI !!!**
April 4, 2006 at 4:48 pm
okay - change the column from "text" to "ctext"..
**ASCII stupid question, get a stupid ANSI !!!**
April 4, 2006 at 5:03 pm
but WHY the difference ?!?! Has it anything to do with our db collations ?!?!
**ASCII stupid question, get a stupid ANSI !!!**
April 4, 2006 at 5:05 pm
try appending ... OPTION(ROBUST PLAN) ... to the query
I don't have sp4. This error tends to happen with "text" columns and merge joins!!
Cheers,
* Noel
April 4, 2006 at 5:13 pm
My SQL Server is SP4.
And everything works perferct.
I have SP with size 104kb. And I can see it in the resultset.
I don't know how collation may affect this query because there is no any string operation, LEN(TEXT) gives you integer values at the entrance, tables are joined by ID.
Error is somewhere else.
What if you run the same query without ORDER BY clause?
_____________
Code for TallyGenerator
April 4, 2006 at 5:18 pm
I am pretty sure that is not the order by is the JOIN TYPE!!! Can you post the query plan you are getting? Merge joins require ordered input or at least an index in that column
Cheers,
* Noel
April 4, 2006 at 6:49 pm
sysobjects O
inner join syscomments S on O.ID = S.ID
Group by O.name
Order by Sum(Len(S.Text)) Desc
|--Sort(ORDER BY: ([Expr1002] DESC))
|--Compute Scalar(DEFINE: ([Expr1002]=If ([Expr1007]=0) then NULL else [Expr1008]))
|--Stream Aggregate(GROUP BY: ([O].[name]) DEFINE: ([Expr1007]=COUNT_BIG(len(.[text])), [Expr1008]=SUM(len(.[text]))))
|--Sort(ORDER BY: ([O].[name] ASC))
|--Merge Join(Inner Join, MERGE: ([O].[id])=(.[id]), RESIDUAL: (.[id]=[O].[id]))
|--Clustered Index Scan(OBJECT: ([DB].[dbo].[sysobjects].[sysobjects] AS [O]), ORDERED FORWARD)
|--Compute Scalar(DEFINE: (.[text]=Convert(If (Convert(syscomments.[status])&2=Convert(2)) then uncompress(syscomments.[ctext]) else Convert(syscomments.[ctext]))))
|--Clustered Index Scan(OBJECT: ([DB].[dbo].[syscomments].[syscomments] AS ), ORDERED FORWARD)
_____________
Code for TallyGenerator
April 4, 2006 at 7:24 pm
I've got the same error when I ran this query against master db!
I modified script a little and error has gone:
select O.name , SumLen
from sysobjects O
INNER JOIN (
select Id, SUM(Len(Text)) as SumLen
from syscomments
GROUP BY ID ) S on O.Id = S.Id
ORDER BY SumLen DESC
_____________
Code for TallyGenerator
April 4, 2006 at 7:43 pm
It's about size of joined rows.
Len(text)*2 + len(name)*2 + other fixed sizes must be < 8095
You can identify problermatic objects with this query:
select O.Name, S.Text, LEN(S.Text), len(O.Name) + LEN(S.Text)
from sysobjects O
inner join syscomments S on O.ID = S.ID
where len(O.Name) + LEN(S.Text) > 4041
_____________
Code for TallyGenerator
April 5, 2006 at 6:57 am
Won't this work?
select objName=object_name(sc.id), Length=len(sc.text)
into #tmpX
from syscomments sc
where OBJECTPROPERTY(sc.id,'IsProcedure') = 1
select objName, Length=sum(length)
from #tmpX
group by objName
order by Length desc
--drop table #tmpX
April 5, 2006 at 7:45 am
THANK YOU ALL!
This works great and now I can assign work for these big suckers!
I wasn't born stupid - I had to study.
Viewing 15 posts - 16 through 30 (of 30 total)
You must be logged in to reply to this topic. Login to reply