# BAQ Error "Bad SQL"

**URL:** <https://www.epiusers.help/t/baq-error-bad-sql/60910>\
**Category:** Epicor ERP 10\
**Tags:** baq, e10\
**Created:** [October 17, 2019, 4:45pm UTC](https://www.epiusers.help/t/baq-error-bad-sql/60910 "2019-10-17T16:45:37Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![hkeric.wci](https://www.epiusers.help/user_avatar/www.epiusers.help/hkeric.wci/32/52019_2.png) [@hkeric.wci](https://www.epiusers.help/u/hkeric.wci)\
**Post date:** [October 17, 2019, 6:21pm UTC](https://www.epiusers.help/t/baq-error-bad-sql/60910/21 "2019-10-17T18:21:09Z")

</div>

I always use the SQL ANSI Standard one, old habits.

```auto
CAST(QuoteNum as nvarchar(52))

```

But yes for you it may have been data, maybe I just dont have any that mix. I also just define it in the JOIN.

Even when you want to specify a specific let’s say “RelatedToFile” you can simply type it into the JOIN

```auto
'SomeTable'

```

Just because its not in the drop-down, doesnt mean it won’t accept it 😃

---

<div class="post-metadata">

**Author:** ![JasonMcD](https://www.epiusers.help/user_avatar/www.epiusers.help/jasonmcd/32/22326_2.png) [@JasonMcD](https://www.epiusers.help/u/JasonMcD)\
**Post date:** [October 17, 2019, 7:59pm UTC](https://www.epiusers.help/t/baq-error-bad-sql/60910/22 "2019-10-17T19:59:46Z")

</div>

The "Bad SQL thing is new, no? I never saw it in 10.1.600, for example.

It also pops up when the BAQ just takes too long to execute. Or if I just cancel a test after a second.

For example, this query runs fine in SSMS (takes 60 seconds), but if I allow 10 minutes in Epicor it won’t ever finish. ([Long story](https://www.epicorusers.org/communities/community-home/digestviewer/viewthread?GroupId=85&MessageKey=09c49758-962e-4d6f-abfc-dc51e5e00149&CommunityKey=df2aacd6-d4fd-42fc-850f-eea2bb5eef97&tab=digestviewer).)  
 ![image](https://www.epiusers.help/uploads/default/original/3X/8/f/8f2bbfbaf60e5001b9125b2f220df4894b1241ec.png)

[Previous page](https://www.epiusers.help/t/baq-error-bad-sql/60910.md?page=1)
