question

Marc avatar image
Marc asked

Connection string properties in a trigger

I have written a trigger that requires information that does not exist in the table being updated. I thought that if I could examine the properties in the connection string that was used to update the table, I could communicate the information to the trigger.

I have examined various system functions to no avail. I hope someone can shed some light on my problem.

triggerconnection-stringmeta-data
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Matt Whitfield avatar image Matt Whitfield ♦♦ commented ·
When you say 'does exist' do you mean 'does not exist'? What is the information, what are you trying to do?
0 Likes 0 ·
Marc avatar image Marc commented ·
Yes, I just fixed my post. Thanks.
0 Likes 0 ·
David 1 avatar image
David 1 answered

Why can't you pass this information as a parameter to a regular stored proc? Stored procedures can have parameters. Triggered procedures cannot.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Rob Farley avatar image
Rob Farley answered

Some are available, most significantly, APP_NAME(), and SYSTEM_USER. I guess it depends on what you're looking for.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Marc avatar image Marc commented ·
I would like to put a value into the connection string, execute the update and have the value available to the trigger when it executes.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.