Hi.
I am quite new into stored procedures written in t-sql. (MSSQL server)
I have three different tables in my DB. Two of the tables (with different
data) are updated regularly and need to be joined into a third
table that works as the basis for an application in ASP.
The two former tables each contain a field with a persons identity number
(called PNR). I need to make sure that this number in a field the
first table is also contained in a field of the second table.
In case the number (10 digits) occurs in the fields of both tables, another
test is performed to check if the number occurs in the appropriate field in
table 3.
If it does nothing should happen to table 3 - however if the number is not
found in table 3 - then an insert of the number (and related data)
should be performed.
The operation needs to be done in a stored procedure since I have to check
about 15.000 rows in each query.
In ASP the operation can be done with multiple loops on the resultsets - how
can the same operation be accomplished in a stored procedure?
Sven