# Toad Data Point - SQL Server - #Temp Tables

**URL:** <https://forums.toadworld.com/t/toad-data-point-sql-server-temp-tables/19281>\
**Category:** Toad Data Point & Toad Intelligence Central\
**Created:** [June 24, 2013, 1:45pm UTC](https://forums.toadworld.com/t/toad-data-point-sql-server-temp-tables/19281 "2013-06-24T13:45:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Smapdi](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@Smapdi](https://forums.toadworld.com/u/Smapdi)\
**Post date:** [June 24, 2013, 1:45pm UTC](https://forums.toadworld.com/t/toad-data-point-sql-server-temp-tables/19281/1 "2013-06-24T13:45:56Z")

</div>

I was using version 3.2 and recently got a new computer, after which I installed version 3.3 base.

Existing automation tasks, which contain a single ‘select to file’ activity, are failing because: “Toad has detected some symbols within the SQL indicating you might be using bind variables…” The problem is that the SQL statement has temp tables involved. I didn’t design the query, so that’s the way it is.

Is there a setting in Toad that I can somehow ignore this validation? The SQL runs fine from the editor. And it ran fine in Automation back in the older version.

---

<div class="post-metadata">

**Author:** ![AlexLuk](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@AlexLuk](https://forums.toadworld.com/u/AlexLuk)\
**Post date:** [June 25, 2013, 2:03am UTC](https://forums.toadworld.com/t/toad-data-point-sql-server-temp-tables/19281/2 "2013-06-25T02:03:30Z")

</div>

Hi,

Please note that this is the SQL Optimizer for SQL Server Forum. You will have to post your question in the Toad Data Point forum if your question is about using Toad Data Point.

Thanks,

Alex

---

<div class="post-metadata">

**Author:** ![Debbie\_Peabody](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/debbie_peabody/32/18_2.png) [@Debbie\_Peabody](https://forums.toadworld.com/u/Debbie_Peabody)\
**Post date:** [June 25, 2013, 11:08am UTC](https://forums.toadworld.com/t/toad-data-point-sql-server-temp-tables/19281/3 "2013-06-25T11:08:21Z")

</div>

Can you send your SQL Script and automation script with log file to me directly so I can take a look at how to fix?

[debbie.peabody@quest.com](mailto:debbie.peabody@quest.com)

---

<div class="post-metadata">

**Author:** ![Debbie\_Peabody](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/debbie_peabody/32/18_2.png) [@Debbie\_Peabody](https://forums.toadworld.com/u/Debbie_Peabody)\
**Post date:** [June 25, 2013, 11:11am UTC](https://forums.toadworld.com/t/toad-data-point-sql-server-temp-tables/19281/4 "2013-06-25T11:11:29Z")

</div>

I entered CR110454 for this but it will help if I can get the scripts.

---

<div class="post-metadata">

**Author:** ![Smapdi](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@Smapdi](https://forums.toadworld.com/u/Smapdi)\
**Post date:** [June 25, 2013, 11:49am UTC](https://forums.toadworld.com/t/toad-data-point-sql-server-temp-tables/19281/5 "2013-06-25T11:49:27Z")

</div>

Debbie, thanks for the help! I think I pinpointed the problem and found a workaround.

The problem seems to be a formatting issue with the SQL Script.

In an automation file, with a single activity [select to file]

This does not work:

USE [comtrac\_dw];

SELECT TOP 1 \*  
INTO #TMP1  
FROM dbo.Codes

SELECT TOP 1 \*  
INTO #TMP2  
FROM dbo.Codes

SELECT rs.\*  
INTO #TMPFINAL  
FROM (SELECT #TMP1.\* FROM #TMP1 UNION ALL SELECT #TMP2.\* FROM #TMP2) rs

SELECT \* FROM #TMPFINAL

However… if I format my subquery with new lines, it works fine.

SELECT TOP 1 \*  
INTO #TMP1  
FROM dbo.Codes

SELECT TOP 1 \*  
INTO #TMP2  
FROM dbo.Codes

SELECT rs.\*  
INTO #TMPFINAL  
FROM (SELECT #TMP1.\* FROM #TMP1  
UNION ALL  
SELECT #TMP2.\* FROM #TMP2  
) rs

This bug appears in other manifestations such as JOIN - but I’ve found as long as the #tmp table is listd on a different line, it seems to work ok.

---

<div class="post-metadata">

**Author:** ![Debbie\_Peabody](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/debbie_peabody/32/18_2.png) [@Debbie\_Peabody](https://forums.toadworld.com/u/Debbie_Peabody)\
**Post date:** [June 26, 2013, 7:47pm UTC](https://forums.toadworld.com/t/toad-data-point-sql-server-temp-tables/19281/6 "2013-06-26T19:47:11Z")

</div>

I am glad you found a work around. I did some testing on the user of SQL Server temp tables and automation and I do see some issues here. I entered CR110492 to look into deeper support for these types of scripts.

Debbie
