How to find out if a row with a specific primary key exists in a table in SQL I have created a table in SQL which is named testTable like this where I have defined the:
PRIMARY KEY (FeatureNbr, DateTime)

CREATE TABLE testTable
(
    [DateTime]    SMALLDATETIME  NOT NULL,
    [FeatureNbr]  SMALLINT       NOT NULL,
    [Value]       FLOAT (53)         NULL,
    [Bool]        BIT                NULL,
    CONSTRAINT UC_testTable UNIQUE (DateTime),
    CONSTRAINT PK_testTable PRIMARY KEY (FeatureNbr, DateTime)
);


I have now inserted 4 rows to the table like this:

INSERT INTO testTable(DateTime, FeatureNbr, Value, Bool) VALUES('10/22/2010 22:47', 0, 0.7556864869907925, 0);
INSERT INTO testTable(DateTime, FeatureNbr, Value, Bool) VALUES('10/22/2010 22:40', 5, 0.7556864869907925, 0);
INSERT INTO testTable(DateTime, FeatureNbr, Value, Bool) VALUES('10/22/2010 21:48', 0, 0.7556864869907925, 0);
INSERT INTO testTable(DateTime, FeatureNbr, Value, Bool) VALUES('10/22/2010 18:48', 20, 0.7556864869907925, 0);


Now assume that this table has 100 million rows or more. What is the fastest way to return if the above rows EXIST by looking at the primary key FeatureNbr, DateTime
We are then looking for exactly the rows which has those primary keys: 


0, '10/22/2010 22:47'
5, '10/22/2010 22:40'
0, '10/22/2010 21:48'
20, '10/22/2010 18:48'

I will for example look for 5000 rows like this. Do I need to in some kind of loop look for each row one by one(perheps an exact search is extremely fast in this case? or how do I return a result for all lines or for each search one by one?).
I will know the FeatureNbr which always are all integers between 0-5000. So we have only 1 of each here which makes it 5000 rows. However, - DateTime will be different for each `FeatureNbr.
I have found this line but I don't know how to apply this , -or if this is the correct thing to use?
If IndexProperty(Object_Id('testTable'), 'MyIndex', 'IndexID') Is Null
I actually tried to look at this link: https://www.w3schools.com/sql/sql_join.asp 
I describes how to INNER JOIN. It seems that I got the correct result using the below code.

Assuming that testTable is the one with 100 Million Rows
Assuming that testTable2 is the one with 5000 Rows

I could find the exact matches for FeatureNbr and DateTime as a result.
Please tell if I do miss anything there or if I am thinking wrong so I can edit the post.
SELECT testTable.DateTime, testTable.FeatureNbr
FROM testTable
INNER JOIN testTable2 ON testTable.FeatureNbr=testTable2.FeatureNbr AND 
                         testTable.DateTime=testTable2.DateTime;