Toad World® Forums

How do I save a cross-connection query so it re-opens as one?


#1

I have created a cross-connection query between two sql servers. When I save the file (as a .sql) and re-open it, it is back in a standard editor, not a cross-connection editor and therefore errors out when attempting to run. I can’t figure out how to switch this existing editor back to cross-connection mode or how to save it so it opens as a cross-connection query n its own. On TDP 4.3.


#2

It should open as Cross-Connection SQL Editer. It scans the SQL and determines that the tables are using connection names as part of a three part identifier. Example below. So for some reason this parsing is failing. Do you have comments or something at the top of your SQL? Or is the file from someone else and you do not have the connections used named the same way?

If not please post your From clause so I can see.

FROM
SQLServer_DailyTest.quest_dev.dbo.REGION REGION
INNER JOIN
MySQL_DailyTest.quest_dev.address address
ON (REGION.REGION_ID = address.REGION_ID)


#4

So for some reason this parsing is failing. Do you have comments or something at the top of your SQL? Or is the file from someone else and you do not have the connections used named the same way? Thanks and Regards, https://get3dsemulator.org/ https://get-cartoonhd.org/


#5

Yes, I have comments at the top. I’ll try deleting them and see is that works, but that is a huge pain since we use headers on all our scripts.


#6

Please confirm that is the issue and then we can see about ignoring the comments at the top.


#7

Looks like if there are any sql server single line comments ("- -" syntax) anywhere in the file, TOAD wont recognize it as a cross-connection query. Multi-line comment sytax ("/* */") appear to be OK.


#8

Sounds like a parsing error. We parse the file to figure out if it is XQuery or not. Can you live with the old style comments?