SQL query for dropdown

Amit Srivastava asked on December 21, 2016 08:24

Hi,

I am using a bizform for some requirement and there is a dropdown in the form, I want to fill that drop down from different server and different database. Please let me know how to fill this dropdown from different server data.

Correct Answer

Anton Grekhovodov answered on December 21, 2016 09:30

Hi Amit,

If you want to use SQL query for dropdown, I think it's better to create a view for this query, so the code in your dropdown will be like :

SELECT ID, Title FROM MyView

Inside the view you just select data from all necessary databases:

SELECT ID, TITLE FROM Server1.Database1.dbo.Table1
UNION
SELECT ID, Title FROM Server2.Database2.dbo.Table2

And you need to add Server1 and Server2 as linked servers for the server where you installed kentico

1 votesVote for this answer Unmark Correct answer

Recent Answers


Trevor Fayas answered on December 21, 2016 15:46

Coupled with this, you may need to employ what are called "Linked Servers" in SQL.

https://msdn.microsoft.com/en-us/library/ff772782.aspx

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.