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 2000 Forums
 Transact-SQL (2000)
 DESC keyword issue

Author  Topic 

ricks1683
Starting Member

14 Posts

Posted - 2008-01-11 : 15:52:39
Hi there. Need a bit of help getting around a problem I've encountered with the DESC keyword.

Here's the Code:

select pol.LOB, pol.PFTCTR, pol.account#, acct.name, St.State,
point.SarClass, TBWC04.DESC, sum(point.SarExposur) Payroll
from pmspsa15 point
join actgdata.dbo.Policyinfo pol on
left(policy#,3) = symbol and substring(policy#, 4,7) = policy0num
and right(policy#,2) = module
join actgdata.dbo.accountinfo acct on
pol.account# = acct.account#
join TBWC04 on
class.class = point.SarClass
join State St on St.StateNumber = SarState
where pol.pftctr in ('TOH','VOH','COH','CAL','LLY','FES') AND pol.LOB = 'WCV'
and pol.incept between '01/01/2007' and '12/31/2007'
group by pol.LOB, pol.PFTCTR, pol.account#, acct.name, St.State,
point.SarClass, TBWC04.DESC
order by pol.LOB, pol.PFTCTR, acct.name, St.State,
point.SarClass, TBWC04.DESC



The problem here is that the column I wish to select is named DESC. Is there any way to get around the error telling me "Server: Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'DESC'." ???

I've tried this in both sql 2000 and 2005 with no different results. Any suggestions? I really appreciate the help!

Thanks,

Rick

jhocutt
Constraint Violating Yak Guru

385 Posts

Posted - 2008-01-11 : 15:57:36
TBWC04.[DESC]



"God does not play dice" -- Albert Einstein
"Not only does God play dice, but he sometimes throws them where they cannot be seen."
-- Stephen Hawking
Go to Top of Page

ricks1683
Starting Member

14 Posts

Posted - 2008-01-11 : 16:00:10
THANK YOU! My headache is now gone!
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-01-11 : 17:11:54
no, your headache will persist for as long as you use reserved words for object names.


elsasoft.org
Go to Top of Page
   

- Advertisement -