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)
 Quotes problem

Author  Topic 

Sarat
Constraint Violating Yak Guru

265 Posts

Posted - 2003-09-15 : 19:22:18
Hello,
I traced a process which has this SQL and I would like to know
what is wrong with it.
see sub-select SELECT ''X'' - I got this from trace file. What is wrong with it? When I run this in QA, i get an error message for the quotes.
--
select * FROM PS_PAY_OTH_EARNS
WHERE COMPANY='DTC'
AND PAYGROUP='DWS'
AND PAY_END_DT= '09/13/03'
AND OFF_CYCLE= 'N'
AND NOT EXISTS (SELECT ''X'' FROM PS_PAY_EARNINGS B
WHERE B.COMPANY=PS_PAY_OTH_EARNS.COMPANY
AND B.PAYGROUP=PS_PAY_OTH_EARNS.PAYGROUP
AND B.PAY_END_DT=PS_PAY_OTH_EARNS.PAY_END_DT
AND B.OFF_CYCLE=PS_PAY_OTH_EARNS.OFF_CYCLE
AND B.PAGE_NUM=PS_PAY_OTH_EARNS.PAGE_NUM
AND B.LINE_NUM=PS_PAY_OTH_EARNS.LINE_NUM
AND B.ADDL_NBR=PS_PAY_OTH_EARNS.ADDL_NBR)
-- Thanks,
Sarat.

**To be intoxicated is to feel sophisticated, but not be able to say it.**

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-09-15 : 19:24:30
Put this statement above your select statement:

SET QUOTED_IDENTIFIER ON

Tara
Go to Top of Page

Sarat
Constraint Violating Yak Guru

265 Posts

Posted - 2003-09-15 : 19:56:41
I tried that, it still gives me the error (they are single qoutes, not double) so I removed one set of quotes and it runs. I don't understand why trace file shows that way.
Anyway, when i ran this query in QA, it took 18 secs so I updated stats on one table and it took zero seconds. I guess I need to schedule update stats job before users run the payroll process.

**To be intoxicated is to feel sophisticated, but not be able to say it.**
Go to Top of Page
   

- Advertisement -