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

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Error With Case statement in View

Author  Topic 

bmahony993
Yak Posting Veteran

58 Posts

Posted - 2008-02-14 : 16:22:35
I have created the view below, the syntax checks fine, but I cannot get it to work. I get the error "Only text pointers are allowed in work tables". It worked fine before I added the Case statement. I added the Case statement because I want the results to be ordered in a particular way. Anyone got any ideas of how to fix it?



SELECT TOP 100 PERCENT a.Acct AS LineNbr,
CASE WHEN LEFT(a.Acct,1) = '4' THEN '1'
WHEN LEFT(a.Acct,1) = '3' THEN '2'
WHEN LEFT(a.Acct,1) = '5' THEN '3'
ELSE '4'
END AS TestOrder,
a.Descr AS LineTitle, a.Active AS LineStatus, anote.sNoteText AS LineText, ac.Descr AS GroupTitle, acnote.sNoteText AS GroupText

FROM dbo.Snote acnote RIGHT OUTER JOIN
dbo.AcctClass ac ON acnote.nID = ac.NoteID
RIGHT OUTER JOIN
dbo.Account a LEFT OUTER JOIN
dbo.Snote anote ON a.NoteID = anote.nID ON ac.ClassID = a.ClassID
ORDER BY testOrder

khusiie
Yak Posting Veteran

78 Posts

Posted - 2008-02-14 : 16:43:28
try to omit dbo.
and see what u get?
Go to Top of Page

bmahony993
Yak Posting Veteran

58 Posts

Posted - 2008-02-14 : 16:43:40
I found a couple of text fields, and used CAST to make them char, and that solved the problem. I'm curious as to why it worked fine before the Case statement was added though.
Go to Top of Page
   

- Advertisement -