Jump to content
Sign in to follow this  

Lookup equivalent in SQL Server?

Recommended Posts


I'm creating a database in SQL Server since I cannot implement FM in my customer business.

It's been too long since the last time I went in SQL.

How do we create a lookup for a field?


Share this post

Link to post
Share on other sites

At the risk of being scolded that this forum is for Filemaker and not for SQL, (and if I understand your question correctly) I believe the following is what you're looking for:

insert into newTable












from lookupTable

where lookupId = @lookupValue

The above code, using a subselect for the insert, emulates Filemaker's "Auto-Enter Looked Up Value" feature at the field definition level. You would have to replace the constants in the select statement with the values captured from your user.

You could also accomplish the same thing with an update following your insert in your code. Do some google searches for 'insert subselect mssql' and you should find some direction. These are just two of the many ways it could be done.

Hope that Helps.


Share this post

Link to post
Share on other sites

I know that we are in a FM forum, but since I am too accustomized to FM I forgot how to think SQL.

For the lookup, would it be better to create an insert trigger?

Share this post

Link to post
Share on other sites

That would work, as well. In general, any time you can keep activity on the server-side, you'll improve the database performance, particularly when you're dealing with MSSQL over a network. The 'best' method is always defined by the application you're trying to create, and the environment in which you are operating.

A quick search for 'mssql insert trigger' turned up quite a few options, but the one at the top should suffice as a guide (the site has been reliable and accurate in the past).


Good Luck!


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.