Is there any way to find particular column in Linked Server's database within all tables.
I guess solution lies in
EXEC sp_columns_ex
Is there any way to find particular column in Linked Server's database within all tables.
I guess solution lies in
EXEC sp_columns_ex
SELECT t.name as TableName, c.name as ColumnName
FROM servernamehere.databasenamehere.sys.columns c
INNER JOIN servernamehere.databasenamehere.sys.tables t ON c.object_id = t.object_id
WHERE c.name like '%yoursearchhere%'
How about this:
EXECUTE [MyLinkedServer].[MyLinkedDB].dbo.sp_executesql
N'SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE ...'
And fill in the where clause depending on what you want to search for?
An alternative would be creating a view that selects from INFORMATION_SCHEMA.COLUMNS
and then you query that instead.
It would depend on which database your linked server is pointing to. For example, if it is Oracle, you would use Oracle syntax, if it is SQL Server, Sql Server Syntax.
The fact that you are querying the schema through a Linked server shouldnt matter.