SQL – Convert

Need to replace a specific char in a string, say for example remove commas so you can export the file in CSV without hassles later on? Easy fix: convert

Syntax:

Convert(string_1, New_Char, Old_Char)

String_1 is the string to be converted

New_Char is the character to set to

Old_Char is the character to be converted

Example:

Convert(‘BIll,Smith’,’ ‘,’,’)

Returns: ‘Bill Smith’

Convert(‘Woger Wabbit’,’R’,’W’)

Returns: ‘Roger Rabbit”

Leave a Reply

Your email address will not be published. Required fields are marked *