Solved

Using sql variable in Trigger

Posted on 2011-03-07
1
246 Views
Last Modified: 2012-05-11
Hi all
I have a trigger , which should read values from a table and call a storeprocedure,,

What is the best way to store these variable retrive from a table.

E.g
SELECT LastName,Firstname
INTO @Lastname, @Firstname
FROM Persons
WHERE City='Sandnes'

execute sp_myPersons @Lastname, @FirstName

Thanks in advance
0
Comment
Question by:ZURINET
1 Comment
 
LVL 15

Accepted Solution

by:
derekkromm earned 500 total points
ID: 35056679
declare @lastname varchar(100), @firstname varchar(100)
select @lastname = lastname, @firstname = firstname
from persons
where city='sandnes'

exec sp_myPersons @Lastname, @FirstName
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question