I have a user defined table type:
CREATE TYPE [ENUM].[str_list_tbltype] AS TABLE(
[STR_NAME] [varchar](100) NOT NULL
)
GO
This comes into the stored procedure as the parameter:
@STR_IDs dbo.str_list_tbltype READONLY,
There is a table, call it idTable and it's data is:
PK Co IDStr
1 4 A3
2 8 B5
3 7 4X
4 8 G4
5 8 B4
Here is a simple select for that table:
SELECT * FROM idTable WHERE Co = 8
Let's say @STR_IDs contains B5 and B4
What I need is to compare using @STR_IDs
Without using a cursor, is there an easier way to do this?
Find out if each and every string in @STR_IDs exists in idTable
Where Co = 8
Something like:
IF EXISTS(SELECT * FROM idTable WHERE Co = 8 AND IDStr IN (SELECT STR_NAME FROM @STR_IDs)
Thanks,
Zath