Search code examples
sql-serveraltersql-view

Can you "change" the data in a view?


Our company for years put an & in the customer ID's. Now we're doing this cloud thing and the &'s are causing problems.

I've got this view that I need to change the '&' to a '_' in the customerID field.

Is there a way to this this?

Thanks,

Onyx


Solution

  • The following SQL statement replaces the '&' with an underscore '_'...

        select replace('A&C','&','_')
    

    In your case, you'd have an expression like...

        select replace([customerID],'&','_')