Passing variable to sql

How to pass variable to sql file.
Im tryin in two ways,

Method 1:

my.sql
 select * from table where col1 = '$1' and col2 = 'text';  
 
Method 1execute: dbaccess database my.sql $var

Method2:

select * from table col1 in (`cat inputfile`) and col2 = 'text'; 
 
 method 2execute: dbaccess database my.sql

But both throwing error.

see if this post helps ...

here's something I do a lot, use a here document in a script or command line...

#! /bin/bash
.
.
.
msyql -u username --password=foobar <<EOD
select * from ${1};
.
.
.
EOD
# back in bash script context