?
Solved

Using sql variable in Trigger

Posted on 2011-03-07
1
Medium Priority
?
262 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 15

Accepted Solution

by:
derekkromm earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
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 video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

764 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