Solved

Using sql variable in Trigger

Posted on 2011-03-07
1
255 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 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get row count of current SQL query 8 68
How to place a condition in a filter criteria in t-sql? 12 89
SQL Query with Sum and Detail rows 2 68
Format Date fields 11 62
There are some very powerful Data Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a discu…
Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

737 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