Answer the question
In order to leave comments, you need to log in
How to query a table whose link is stored in another table?
Good afternoon.
There is a table consisting of three columns: id, dictionary name, link_to_dictionary.
The "link_to_dictionary" column stores the full name of the table it refers to.
Question: how can I make a query to a table using an existing link?
Answer the question
In order to leave comments, you need to log in
use dynamics:
DECLARE @tableName NVARCHAR(20);
SELECT @tableName = dictionary_link FROM table1;
EXEC(' SELECT * FROM '[email protected]+' WHERE 1 = 1 ');
CREATE TABLE #test (id INT);
INSERT INTO #test EXEC(' SELECT id FROM '[email protected]+' WHERE 1 = 1 ');
-- или так:
EXEC(' SELECT id INTO #test FROM '[email protected]+' WHERE 1 = 1 ');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question