Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sdtfll
Contributor III
Contributor III

how to understand the set function in this situation?

dbo.Person table: 

id name

1 Grant

2  Jim

3   Bob

 

--------------------------------------------------------------------------------------

set a = 1,2;

names:

load id,name;

SQL select id,name 

FROM dbo.Person WHERE id IN ($(a));   // output: 1 Grant ; 2 Jim

 

 

set a = Grant, Jim;

names:

load id,name;

SQL select id,name 

FROM dbo.Person WHERE name IN ($(a));   // failed

1 Solution

Accepted Solutions
Saravanan_Desingh

Try this,

set a = 'Grant','Jim';

names:
load id,name;
SQL select id,name 
FROM dbo.Person WHERE name IN ($(a));

View solution in original post

2 Replies
Saravanan_Desingh

Try this,

set a = 'Grant','Jim';

names:
load id,name;
SQL select id,name 
FROM dbo.Person WHERE name IN ($(a));
sdtfll
Contributor III
Contributor III
Author

Perfect, it works now, thanks so much.