I've spent about 12 hours trying to figure this out.
I'm trying to replace the asci for french characters to what it actually is.
After the database entry is made, if there are any french characters entered, I need to replace them. I'd like to do this with a loop if I can as I need to check more then one field and more then one type of french character.
declare @SQL varchar(1000)
declare @fieldName varchar(50)
declare @frenchCode varchar(50)
declare @frenchChar varchar(5)
declare @userId numeric
set @fieldName = 'firstName'
set @frenchCode = '''é'''
set @frenchChar = '''é'''
set @userId = 37
set @SQL = 'UPDATE tbl_table SET ' + @fieldName + '= replace(' + @fieldName + ', ' + @frenchCode + ', ' + @frenchChar + ') WHERE id = ' + @userId
if exists (SELECT @fieldName FROM tbl_table WHERE @fieldName like '%@frenchCode%')
exec(@SQL)
Can someone please offer some advice?
Thank you,
Seven
I'm trying to replace the asci for french characters to what it actually is.
After the database entry is made, if there are any french characters entered, I need to replace them. I'd like to do this with a loop if I can as I need to check more then one field and more then one type of french character.
declare @SQL varchar(1000)
declare @fieldName varchar(50)
declare @frenchCode varchar(50)
declare @frenchChar varchar(5)
declare @userId numeric
set @fieldName = 'firstName'
set @frenchCode = '''é'''
set @frenchChar = '''é'''
set @userId = 37
set @SQL = 'UPDATE tbl_table SET ' + @fieldName + '= replace(' + @fieldName + ', ' + @frenchCode + ', ' + @frenchChar + ') WHERE id = ' + @userId
if exists (SELECT @fieldName FROM tbl_table WHERE @fieldName like '%@frenchCode%')
exec(@SQL)
Can someone please offer some advice?
Thank you,
Seven