sql help

Hi all,

I have a sql like this.

select a, b from my_schema.my_table
where a in (
5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009,
5010, 5011, 5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019,
5020, 5021, 5022, 5023, 5024, 5025, 5026, 5027, 5028, 5029,
5030
);

Now i am expecting the values to grow. What i would like is if i can maintain a simple txt file which will store values like 5000,5001,5002,etc and if i can feed that txt file to the sql above. Is this possible?

Any help is appreciated

Thanks,
JAK

If your sql query is inside a bash script, this works.

$ cat ids.txt
2,3,4,5,6,7

$ ./mysql_e.sh
2,3,4,5,6,7
id      data
2       Goofy
4       Goofy
5       Goofy
6       Goofy
7       Goofy

$ cat mysql_e.sh
var=`cat ids.txt`
echo $var
/usr/bin/mysql -u root << eof
select id,data from NMS.main where id in ($var);
eof

//Jadu

Thanks, I will give it a try