Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 query help

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2010-06-13 : 05:46:48
in my storedprocedure

I want to do the following query

select applicantid from applicants where postcode=@postcode and firstname=@firstname and lastname=@lastname

then based on the results insert into another table caled linkedapplicants (applicantid,linkedapplicantid)
@applicantid, and the applicantid from the query (a row matching each row returned)
what's the best way to do this?

Kristen
Test

22859 Posts

Posted - 2010-06-13 : 06:17:50
[code]INSERT INTO linkedapplicants
(
applicantid, linkedapplicantid
)
SELECT @applicantid, applicantid
FROM applicants
WHERE postcode=@postcode
and firstname=@firstname
and lastname=@lastname
[/code]
Is this it? or is there some other complication?
Go to Top of Page
   

- Advertisement -