I am trying to insert a £ sign into an sql server database but it is storing it a & and I have no idea why. I have tried £ and £ and £ I am using CONVERT(varchar(1),?) and it is a varchar(1) field. Thanks
Try using nvarchar rather than just varchar.
1 Like
Just in the code or change the DB definition or both?
drop table knuts
create table knuts(monetaryunit varchar(1))
insert into knuts
select '£'
select * from knuts
drop table knuts
create table knuts(monetaryunit nvarchar(1))
insert into knuts
select '£'
select * from knuts
it works on both varchar and nvarchar. Maybe it has to do with the server/db collation?
It was ok when it was Classic asp inserting a £ but not php. With PHP if I did just a £ I got a funny a sign.
The collation by the look of it is latin1_general without UTF-8 selected.
There is Latin1_general_100 and Latin1_general_100_bin2_utf8
Are any of those correct for a £? I am not used to sql server - I am used to MySql so I don't want to mess anything up by changing it. Thanks