Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
zhshqzyc
Posting Yak Master
240 Posts |
Posted - 2008-08-18 : 11:42:39
|
Can you please look at my query?Select TOP 10 ID,DESCR FROM TABLEAWHERE DESCR like "~KeyWord~+'%'" ~KeyWord~ is an input variable in my xml file.I think it is wrong here.Maybe ''_KeyWord~'+'%''??I can't obtain the right results.I want to make it asWHERE DESCR like 'CPU%'orWHERE DESCR like 'TV%' |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-18 : 11:44:55
|
| what's this db? is it sql server? in sql server variables are refered using @ so the above query will be Select TOP 10 ID,DESCR FROM TABLEAWHERE DESCR like @KeyWord +'%' |
 |
|
|
zhshqzyc
Posting Yak Master
240 Posts |
Posted - 2008-08-18 : 11:59:36
|
| Well.Let me say in this way.Suppose I set the condition as WHERE DESCR LIKE'CPU%'Can I replace it with''CPU' + '%'' |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-18 : 13:49:40
|
| yup you can with slight change. its not " but 'WHERE DESCR LIKE 'CPU' + '%' |
 |
|
|
|
|
|