If someone has 2 minutes could you please run the following scripts that perform the following:
a) create a table named 'eraseme'
b) insert some records into table 'eraseme'
c) run 2 select queries against table 'eraseme'
d) drop table 'eraseme'
Afterwards compare the results of the two select queries. If they are exactly the same then you could you think of why my results are not. I am actually getting an incorrect order when I sort using the nvarchar field but the correct order when I convert this field to varchar during the select.
If you are getting different results then is this a SQL Server bug?
Thanks a lot,
JB
CREATE TABLE dbo.[eraseme] (
[F1] [nvarchar] (10) NOT NULL
) ON [PRIMARY]
GO
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("x-a"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("xmas"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("xmas"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("x'mas"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("x-mas"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("xmas A"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("X'mas B"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("x-mas B"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("xmas BB"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("x'mas CC"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("X-mas CC"
GO
select
f1
from eraseme
order by f1
select
f1
from eraseme
order by convert(varchar, f1)
GO
drop table dbo.[eraseme]
GO
a) create a table named 'eraseme'
b) insert some records into table 'eraseme'
c) run 2 select queries against table 'eraseme'
d) drop table 'eraseme'
Afterwards compare the results of the two select queries. If they are exactly the same then you could you think of why my results are not. I am actually getting an incorrect order when I sort using the nvarchar field but the correct order when I convert this field to varchar during the select.
If you are getting different results then is this a SQL Server bug?
Thanks a lot,
JB
CREATE TABLE dbo.[eraseme] (
[F1] [nvarchar] (10) NOT NULL
) ON [PRIMARY]
GO
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("x-a"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("xmas"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("xmas"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("x'mas"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("x-mas"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("xmas A"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("X'mas B"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("x-mas B"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("xmas BB"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("x'mas CC"
INSERT INTO dbo.[eraseme]
(F1)
VALUES
("X-mas CC"
GO
select
f1
from eraseme
order by f1
select
f1
from eraseme
order by convert(varchar, f1)
GO
drop table dbo.[eraseme]
GO