Re: MSSQL LIKE and IN statements in ADO problem
- From: Peter A. Schott <paschott@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 18 Jan 2006 22:46:59 GMT
Well, the raw TSQL would be:
select * from tb_name where firstname like '%raj%'
I think that would more translate to:
name = "raj"
cmd.CommandText = "SELECT * FROM tb_name WHERE firstname like '%%%s%%'" % name
Perhaps issuing a print statement of the CommandText would help for future runs
to determine if this is valid TSQL syntax?
-Pete
"gregarican" <greg.kujawa@xxxxxxxxx> wrote:
> Can't you get rid of the Create Parameter part and directly pass along
> the value you are looking for? Something like...
>
> name = 'raj'
> cmd.CommandText= \
> "SELECT * FROM tb_name WHERE firstname LIKE %%%s" % name
>
> This way the value of the name variable gets passed along when the
> CommandText method is invoked. BTW, this looks too painfully much like
> Visual Basic than Python :-) Just kidding (kind of)
.
- Follow-Ups:
- Re: MSSQL LIKE and IN statements in ADO problem
- From: Raja Raman Sundararajan
- Re: MSSQL LIKE and IN statements in ADO problem
- References:
- MSSQL LIKE and IN statements in ADO problem
- From: ram0812
- Re: MSSQL LIKE and IN statements in ADO problem
- From: gregarican
- MSSQL LIKE and IN statements in ADO problem
- Prev by Date: A simpler more pythonic approach to adding in
- Next by Date: Re: MySQLdb - Query/fetch don't return result when it *theorically* should
- Previous by thread: Re: MSSQL LIKE and IN statements in ADO problem
- Next by thread: Re: MSSQL LIKE and IN statements in ADO problem
- Index(es):