Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

I have one lakh policy nos, I have to select the data for all one lakh policies at a time. How can i get this done by using sql server query.
For example,
select * from policy
where policy_no in (1,2,3,4,.....100000).

Please help me to resolve this issue.

What I have tried:

Dear All,

I have one lakh policy nos, I have to select the data for all one lakh policies at a time. How can i get this done by using sql server query.
For example,
select * from policy
where policy_no in (1,2,3,4,.....100000).

Please help me to resolve this issue.
Posted
Updated 20-Jan-17 1:36am
Comments
Tomas Takac 20-Jan-17 5:01am    
No sure what's the problem here but did you try:
SELECT * FROM policy WHERE policy_no BETWEEN 1 AND 100000

If the allowed policy numbers is not a range (from 1 to X) then I would suggest creating a table for allowed numbers and using that in your query.

For example
Table AllowedPolicyNo
- 1
- 15
- 18...


And the query
select * from policy p
where p.policy_no in (select apn.policy_no from allowedpolicyno apn).

Or you can use a join if you prefer that
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900