update using a wildcard. Thank

  • an com thôi

    ai r?nh thì an com tru?c di

     

    • This topic was modified 5 years, 8 months ago by  Anatoliaad.
  • From Google Translate

    Is it possible to update values based on wildcards? For example, I have many days in the database formatted with different criteria and I want them all to be MM / DD / YYYY. To make things a little different, the value inside this field can represent anything, not just a day. I want to only update the values kept on the wrong format.
    So I made a query:
    choose the distinct IndexFieldText from dbo.DocumentField in which IndexFieldText like '% / _ /%'
    This will only bring the date values to a single digit.

    I can update these values by using the update query with a wildcard, such as:
    update dbo.tablename set IndexFieldText = '% / 0 _ /%' where IndexFieldText is like '% / _ /%'

    No, you cannot use the wildcards in the update.

  • If that Google translate is to be relied on, your statement about changing the format of your dates is a little confusing. You don't store the format of a date in SQL Server, they are stored as a binary values; your presentation layer then does the formatting. You can't change the format of a date in the data.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Thom A - Sunday, March 10, 2019 5:54 AM

    If that Google translate is to be relied on, your statement about changing the format of your dates is a little confusing. You don't store the format of a date in SQL Server, they are stored as a binary values; your presentation layer then does the formatting. You can't change the format of a date in the data.

    Based on this statement, I take it to be an EAV table, where the Attribute Value is stored as a varchar.

    To make things a little different, the value inside this field can represent anything, not just a day

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

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