Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Lookup equivalent in SQL Server?

Featured Replies

Hi,

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?

Thanx

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

(tableId,

tableName,

tableAddr1,

tableAddr2,

tableCode)

select

'1',

lookupName,

lookupAddr1,

lookupAddr2,

'test'

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.

-Kevin

  • Author

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?

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).

http://www.devarticles.com/c/a/SQL-Server/Using-Triggers-In-MS-SQL-Server/

Good Luck!

-Kevin

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.