In the object details window, under the data tab, open the Filter Data window to add a filter to the data grid. In the Filter Data window, there is an option to write a custom sql query to use as the filter. But while writing out the query here, code completion is enabled and pops up a list of possible objects. But the list is incorrect. It does not list the right columns for the noted table. It list other things like functions or variables.
The same query written out in the editor does properly display a valid code completion list.
The Filter Data window is not associated to the database and connection. The custom SQL tab does not know what database you're working in so it needs to be specified in the SQL. If it is not specified, the code completion list will display incorrect objects since it does not know how to query for the related objects.
It does not work like the editor, as the editor is associated to the database and connection automatically.
RESOLUTION:
By default, the custom SQL window will have generated a basic query for the related object which includes the database name prefixed to the table name. This is required for the sql and code completion in that window. If changing the query, make sure to prefix object names with the database to have work correctly.
Either of the two samples below are correct script for the custom SQL window in Filter Data:
USE <database name>;
GO
SELECT * FROM <table>;
-- continue customizing the sql for filtering
or
SELECT * FROM <database name>.<user>.<table>;
-- continue customizing the sql for filtering
-- This query is the default format for the custom sql window
STATUS:
Enhancement request ST100654 has been submitted to development for consideration in a future release of Toad For SQL Server.
© 2021 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy