开发者

how to tell in which column the search string was found?

is it possible t开发者_StackOverflow中文版o tell in which column the search string was found, without having to do it with ifs?

if <searchstring> in column1
    -- do some stuff here
else if <searchstring> in column2
    ...
...

i won't post the exact query, as it is too cryptical and too long, but here's a query which does basically the same

select
    title,
    description
from
    position
where
    CONTAINS( (title, description), '"manager"' )


You can take help of INFORMATION_SCHEMA.view_name. in this case, like in BOL

SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE IS_NULLABLE = 'NO' ORDER BY DATA_TYPE;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜