If you want to loop through a list of SNPs, some scripting will be necessary as outlined by Chris.
Here's a partial, quick-and-dirty solution using your data. Assuming that by "chr:pos format", you have a file called snps.txt which looks like this:
1:10327
1:10434
1:10440
1:10469
...
You could use this awk one-liner to rewrite the file in the form of SQL queries:
awk 'BEGIN {FS=":"; OFS=""} {print "select chrom,chromStart,name from snp132
where chrom = \"chr",$1,"\" and chromStart + 1 = ",$2,";"}' snps.txt > snps.sql
Which will generate a file snps.sql looking like this:
select chrom,chromStart,name from snp132 where chrom = "chr1" and chromStart + 1 = 10327;
select chrom,chromStart,name from snp132 where chrom = "chr1" and chromStart + 1 = 10434;
select chrom,chromStart,name from snp132 where chrom = "chr1" and chromStart + 1 = 10440;
select chrom,chromStart,name from snp132 where chrom = "chr1" and chromStart + 1 = 10469;
...
Then query the MySQL server using:
mysql -h genome-mysql.cse.ucsc.edu -u genome -A -D hg19 --skip-column-names < snps.sql
Result:
chr1 10326 rs112750067
chr1 10433 rs56289060
chr1 10439 rs112155239
chr1 10439 rs112766696
chr1 10468 rs117577454
Note: This assumes that the SNP positions in your file are 1-based and you want to match them only with chromStart in the UCSC MySQL table, which is 0-based. You may want to match with chromEnd, or use both chromStart and chromEnd (they are not always equal), in which case the query will be more complex.
Firing off individual queries to the MySQL server is rather slow and inefficient. Try not to hammer their server, or they will probably block you. However, it's not difficult to set up a local MySQL server with only the tables that you need.
I don't really see how that invalidates my solution; however, feel free to provide an answer using a bin query :-)
+1: the performance is not an issue here, and Neil's solution is elegant.
@Neil you're not Australian, you're using the UCSC and not biomart: it's the end of my world for good :-)
Sorry for keeping downvoting for the same problem: chromStart in the snp132 table is NOT indexed. Understand and use the "bin" field please (see also http://bit.ly/ucscsql).
Your answer gives the right results, but we should discourage inefficient SQL, for you and for others connecting to UCSC MySQL.
For a couple SNPs, not using bin is fine. But Zach has 700 SNPs. Querying 700 SNPs this way is going to be very inefficient. There are simply much better solutions.