"Only text pointers are allowed..."

"Only text pointers are allowed..."

Post by Jeff Emric » Sat, 26 Apr 2003 11:47:41



I have a stored procedure that performs several LEFT OUTER JOINs with tables
that are located on a different server.  When I run my sp in my test
environment, everything's just grand, but on the production server I'm
getting a message as follows:

"Only text pointers are allowed in work tables, never text, ntext, or image
columns. The query processor produced a query plan that required a text,
ntext, or image column in a work table."

I found a KB article that talks about receiving this error when performing
FULL OUTER JOINs but I am not doing that.  Any ideas?

The sp code follows....

Thanks in advance,
Jeff

SP CODE
(might want to widen your window to prevent ugly word wrapping)
------------

CREATE PROCEDURE sp_report_labor_hours_expanded


AS

SET DATEFIRST 1  --sets first day of week to Monday

select
   ISNULL(TU.TaskTime, 0) as [Time],
   ISNULL(TU.TravelTime, 0) as [Travel Time],
   TU.WorkDate as [Work Date],
   E.LastName + ', ' + E.FirstName as [Employee Name],
   CASE
      WHEN DATEPART(dw, TU.WorkDate) > 5 THEN ISNULL(TU.TaskTime +
TU.TravelTime,0)
      WHEN DATEPART(dw, TU.WorkDate) <= 5 THEN 0
   END as [Weekend],
   CASE
      WHEN DATEPART(dw, TU.WorkDate) > 5 OR (ISNULL(TU.TaskTime +
TU.TravelTime,0) < 8) THEN 0
      WHEN DATEPART(dw, TU.WorkDate) <= 5 AND (ISNULL(TU.TaskTime +
TU.TravelTime,0) > 8) THEN ISNULL(TU.TaskTime + TU.TravelTime,0) - 8
   END as [Overtime],
   CASE
      WHEN DATEPART(dw, TU.WorkDate) <= 5 AND (ISNULL(TU.TaskTime +
TU.TravelTime,0) > 8) THEN 8
      WHEN DATEPART(dw, TU.WorkDate) <= 5 AND (ISNULL(TU.TaskTime +
TU.TravelTime,0) <= 8) THEN ISNULL(TU.TaskTime + TU.TravelTime,0)
      WHEN DATEPART(dw, TU.WorkDate) > 5 THEN 0
   END as [Straight],
   ISNULL(TU.TaskTime + TU.TravelTime,0) as [Total],
   SC.ServiceCode1 + '-' + SC.ServiceCode2 + '-' + SC.ServiceCode3 as
[Service Code],
   CAST(ISNULL(SC.Absorbed,0) AS bit) as [Absorbed],
   TU.EntryDate as [Entry Date],
   T.RefNum as [Ref. No.],
   TU.Ticket_ID as [Ticket No.],
   T.Description as [Ticket Description],
   TU.PublicComments as [Public Comments],
   TU.PrivateComments as [Private Comments]
from HQDB02.NES.dbo.TicketUpdate TU
   left outer join HQDB02.NES.dbo.Ticket T on TU.Ticket_ID = T.ID
   left outer join HQDB02.NES.dbo.ServiceCode SC on TU.ServiceCode_ID =
SC.ID
   left outer join HQDB02.NES.dbo.Employee E on TU.Employee_ID = E.ID
where

   OR

order by [Absorbed] desc, [Work Date] desc, [Ticket No.]

SET DATEFIRST 7  --sets first day of week back to Sunday (default)

 
 
 

"Only text pointers are allowed..."

Post by Vinod » Sat, 26 Apr 2003 12:07:30


Can have a look into the below solution ...

http://dbforums.com/arch/73/2002/4/357328

Try removing the ISNULL from the Text column (if any)...

Try removing Text columns from the Select clause ...

--
HTH,
Vinod Kumar
MCSE, DBA, MCAD
SCT Software Solutions


> I have a stored procedure that performs several LEFT OUTER JOINs with tables
> that are located on a different server.  When I run my sp in my test
> environment, everything's just grand, but on the production server I'm
> getting a message as follows:

> "Only text pointers are allowed in work tables, never text, ntext, or image
> columns. The query processor produced a query plan that required a text,
> ntext, or image column in a work table."

> I found a KB article that talks about receiving this error when performing
> FULL OUTER JOINs but I am not doing that.  Any ideas?

> The sp code follows....

> Thanks in advance,
> Jeff

> SP CODE
> (might want to widen your window to prevent ugly word wrapping)
> ------------

> CREATE PROCEDURE sp_report_labor_hours_expanded


> AS

> SET DATEFIRST 1  --sets first day of week to Monday

> select
>    ISNULL(TU.TaskTime, 0) as [Time],
>    ISNULL(TU.TravelTime, 0) as [Travel Time],
>    TU.WorkDate as [Work Date],
>    E.LastName + ', ' + E.FirstName as [Employee Name],
>    CASE
>       WHEN DATEPART(dw, TU.WorkDate) > 5 THEN ISNULL(TU.TaskTime +
> TU.TravelTime,0)
>       WHEN DATEPART(dw, TU.WorkDate) <= 5 THEN 0
>    END as [Weekend],
>    CASE
>       WHEN DATEPART(dw, TU.WorkDate) > 5 OR (ISNULL(TU.TaskTime +
> TU.TravelTime,0) < 8) THEN 0
>       WHEN DATEPART(dw, TU.WorkDate) <= 5 AND (ISNULL(TU.TaskTime +
> TU.TravelTime,0) > 8) THEN ISNULL(TU.TaskTime + TU.TravelTime,0) - 8
>    END as [Overtime],
>    CASE
>       WHEN DATEPART(dw, TU.WorkDate) <= 5 AND (ISNULL(TU.TaskTime +
> TU.TravelTime,0) > 8) THEN 8
>       WHEN DATEPART(dw, TU.WorkDate) <= 5 AND (ISNULL(TU.TaskTime +
> TU.TravelTime,0) <= 8) THEN ISNULL(TU.TaskTime + TU.TravelTime,0)
>       WHEN DATEPART(dw, TU.WorkDate) > 5 THEN 0
>    END as [Straight],
>    ISNULL(TU.TaskTime + TU.TravelTime,0) as [Total],
>    SC.ServiceCode1 + '-' + SC.ServiceCode2 + '-' + SC.ServiceCode3 as
> [Service Code],
>    CAST(ISNULL(SC.Absorbed,0) AS bit) as [Absorbed],
>    TU.EntryDate as [Entry Date],
>    T.RefNum as [Ref. No.],
>    TU.Ticket_ID as [Ticket No.],
>    T.Description as [Ticket Description],
>    TU.PublicComments as [Public Comments],
>    TU.PrivateComments as [Private Comments]
> from HQDB02.NES.dbo.TicketUpdate TU
>    left outer join HQDB02.NES.dbo.Ticket T on TU.Ticket_ID = T.ID
>    left outer join HQDB02.NES.dbo.ServiceCode SC on TU.ServiceCode_ID =
> SC.ID
>    left outer join HQDB02.NES.dbo.Employee E on TU.Employee_ID = E.ID
> where

>    OR

> order by [Absorbed] desc, [Work Date] desc, [Ticket No.]

> SET DATEFIRST 7  --sets first day of week back to Sunday (default)