Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Foreign key drop-down support in data grid for MSSQL #150

Closed
jimtut opened this issue Feb 21, 2018 · 3 comments
Closed

Foreign key drop-down support in data grid for MSSQL #150

jimtut opened this issue Feb 21, 2018 · 3 comments

Comments

@jimtut
Copy link

@jimtut jimtut commented Feb 21, 2018

Steps to reproduce this issue

  1. Step 1; Enable the preference "Show value in foreign key columns"
  2. Step 2; Access a SQL Server DB with foreign keys
  3. Step N; Open the Data tab and look at a field with a foreign key

Current behavior

Currently, HeidiSQL shows the original value in the field, not the value that the foreign key points to.

Expected behavior

HeidiSQL should provide a drop-down list of possible values from the foreign table, similar to how it does for Maria/MySQL.

Possible solution

The way to query foreign keys is documented by Microsoft, basically:

SELECT   
    f.name AS foreign_key_name  
   ,OBJECT_NAME(f.parent_object_id) AS table_name  
   ,COL_NAME(fc.parent_object_id, fc.parent_column_id) AS constraint_column_name  
   ,OBJECT_NAME (f.referenced_object_id) AS referenced_object  
   ,COL_NAME(fc.referenced_object_id, fc.referenced_column_id) AS referenced_column_name  
   ,is_disabled  
   ,delete_referential_action_desc  
   ,update_referential_action_desc  
FROM sys.foreign_keys AS f  
INNER JOIN sys.foreign_key_columns AS fc   
   ON f.object_id = fc.constraint_object_id   
WHERE f.parent_object_id = OBJECT_ID('<tablename>');

Environment

  • HeidiSQL version:

9.5.0.5253

  • Database system and version:

MS SQL any version, but tested with SQL Server 2017 Express

@ansgarbecker ansgarbecker changed the title Added foreign-key drop-down support for MSSQL too Foreign key drop-down support in data grid for MSSQL Feb 24, 2018
@oegstgeest

This comment has been minimized.

Copy link

@oegstgeest oegstgeest commented Nov 28, 2019

I just migrated from Windows7/MySQL to Windows10/MSSQL.
It is really disappointing to find the drop-down is missing where it used to be...

@ansgarbecker

This comment has been minimized.

Copy link
Collaborator

@ansgarbecker ansgarbecker commented Jan 26, 2020

Works for me now, please check the next build:

grafik

@oegstgeest

This comment has been minimized.

Copy link

@oegstgeest oegstgeest commented Feb 7, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.