Find column

  • How can i find in which field of a table I have the data '05/12/2006'

  • You'd have to query all fields.

    select top 1 * from Mytable

    where col1 = '05/12/2006'

    select top 1 * from Mytable

    where col2 = '05/12/2006'

    etc.

    If this is a datetime, only query date fields. If it's char, go for char, etc.

  • is there any other way where I can find the column name with the given data.

  • Mike,

    Are you searching through just one table of columns, or an entire database of tables and the columns within the tables?

    If you give us more information on how broad a search you need, there is most likely a dynamic SQL query that we can assist you with.

    "Key"
    MCITP: DBA, MCSE, MCTS: SQL 2005, OCP

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply