Friday, February 10, 2012
Comparision test SQL 7.0 and 2000
I'm in the process of doing a compatibility test on files generated from the
same database on SQL 2000 (which is also running in 6.5 compatibility mode -
I copied it from the 7.0 server using the 2000 copy database wizard). I'm
getting different results when I create a file against test data, and don't
understand why. The file is generated from a query. The differences in the
file seem to be due to how the DirActivityLog sorts when it is matched.
The query is:
declare @.start as datetime,
@.stop as datetime
Select @.start = '03/15/05 00:01:00', @.stop = '04/15/05 00:01:00'
Select Dir.DirCode, Dir.PubCode, Dir.CountryCode,
Dir.StateCode, Dir.DirNameFull, Dir.DirNameAbbr,
Dir.FocusCode, Dir.SubCatCode, Dir.SectionFlag, dir.Action,
da.ActivityCode
from RDHistory..Directory dir (NOLOCK), DirActivityLog da (NOLOCK)
where dir.BatchRcvdDate between @.start and @.stop
and dir.CompleteFlag = 1 and
dir.DirCode *= da.DirCode and
dir.BatchRcvdDate *= da.ActivityDate
order by dir.DirCode, dir.HistID
The data contains 2 records in RDHistory..Directory for dircode 116004,
BatchRcvdDate = '3/29/05 7:00:00 AM' - the first with histid 35097 and actio
n
'U", and the second with histid 35098 and action 'D'.
DirActivityLog contains 2 records for the same dircode 116004, with
ActivityDate = '3/29/05 7:00:00 AM' - the first record with Logid 47563 and
ActivityCode = 'N' and the second with Logid 47564 and ActivityCode 'D'.
On SQL 7.0, I get the following 4 rows with this in the DirCode, ActionCode
and ActivityCode fields:
116004,U,N
116004,U,D
116004,D,N
116004,D,D
On SQL 2000, I get the following 4 rows with this in the DirCode, ActionCode
and ActivityCode:
116004,U,N
116004,U,D
116004,D,D
116004,D,N
This changes the results written out to the end file.
The execution plans on both servers seem to be the same. The code page and
sortid used on SQL 7.0 seems compatibile with the collation used on SQL 2000
.
I can solve this problem by adding more sort fields to the query, but I'd
rather not modify the application if I can help it - and I don't know why
this is occuring.
Help!SQLDeb" <SQLDeb@.discussions.microsoft.com> wrote in message
news:FD582374-795E-4AF6-902F-9C5F76F9561A@.microsoft.com...
>I have a 6.5 compatibility mode database that is running on SQL Server 7.0.
> I'm in the process of doing a compatibility test on files generated from
> the
> same database on SQL 2000 (which is also running in 6.5 compatibility
> mode -
> I copied it from the 7.0 server using the 2000 copy database wizard). I'm
> getting different results when I create a file against test data, and
> don't
> understand why. The file is generated from a query. The differences in
> the
> file seem to be due to how the DirActivityLog sorts when it is matched.
> The query is:
> declare @.start as datetime,
> @.stop as datetime
> Select @.start = '03/15/05 00:01:00', @.stop = '04/15/05 00:01:00'
> Select Dir.DirCode, Dir.PubCode, Dir.CountryCode,
> Dir.StateCode, Dir.DirNameFull, Dir.DirNameAbbr,
> Dir.FocusCode, Dir.SubCatCode, Dir.SectionFlag, dir.Action,
> da.ActivityCode
> from RDHistory..Directory dir (NOLOCK), DirActivityLog da (NOLOCK)
> where dir.BatchRcvdDate between @.start and @.stop
> and dir.CompleteFlag = 1 and
> dir.DirCode *= da.DirCode and
> dir.BatchRcvdDate *= da.ActivityDate
> order by dir.DirCode, dir.HistID
> The data contains 2 records in RDHistory..Directory for dircode 116004,
> BatchRcvdDate = '3/29/05 7:00:00 AM' - the first with histid 35097 and
> action
> 'U", and the second with histid 35098 and action 'D'.
> DirActivityLog contains 2 records for the same dircode 116004, with
> ActivityDate = '3/29/05 7:00:00 AM' - the first record with Logid 47563
> and
> ActivityCode = 'N' and the second with Logid 47564 and ActivityCode 'D'.
> On SQL 7.0, I get the following 4 rows with this in the DirCode,
> ActionCode
> and ActivityCode fields:
> 116004,U,N
> 116004,U,D
> 116004,D,N
> 116004,D,D
> On SQL 2000, I get the following 4 rows with this in the DirCode,
> ActionCode
> and ActivityCode:
> 116004,U,N
> 116004,U,D
> 116004,D,D
> 116004,D,N
>
This is expected. Your ORDER BY does not impose a complete ordering on the
results. The first two records have HistID=35097 and the second two have
HistID=35098. Beyond that, the order is unpredictable.
You have asked the server to "order by dir.DirCode, dir.HistID", and it is.
But since multiple rows in the result can share the same (DirCode,HistID),
you have also told the server that you do not care about the ordering beyond
DirCode and HistID. Unordered rows are returned an a order which is an
accident of the implementation of the query execution. The order of these
rows was never guaranteed in SQL 6.5, and so there is no flag to force SQL
2000 to reproduce the order from 6.5.
You must decide how you want the results sorted, and force the sort order by
adding appropriate columns to the ORDER BY.
David|||"David Browne" wrote:
> You have asked the server to "order by dir.DirCode, dir.HistID", and it is
.
> But since multiple rows in the result can share the same (DirCode,HistID),
> you have also told the server that you do not care about the ordering beyo
nd
> DirCode and HistID. Unordered rows are returned an a order which is an
> accident of the implementation of the query execution. The order of these
> rows was never guaranteed in SQL 6.5, and so there is no flag to force SQL
> 2000 to reproduce the order from 6.5.
> You must decide how you want the results sorted, and force the sort order
by
> adding appropriate columns to the ORDER BY.
> David
Thanks for your quick response. I understand your point, and I can
certainly modify the order by clause in the sql statement to enforce the
order I want. However, what I don't understand is why SQL Server 7.0 would
consistently implement the sql one way, and SQL Server 2000 would
consistently implement it in another. If I got random sort results on these
fields on both servers - that I would understand. Any idea of what's change
d?|||"SQLDeb" <SQLDeb@.discussions.microsoft.com> wrote in message
news:C6CFDE94-0F46-474B-A9AA-CF7B2ADB6181@.microsoft.com...
> "David Browne" wrote:
>
> Thanks for your quick response. I understand your point, and I can
> certainly modify the order by clause in the sql statement to enforce the
> order I want. However, what I don't understand is why SQL Server 7.0
> would
> consistently implement the sql one way, and SQL Server 2000 would
> consistently implement it in another. If I got random sort results on
> these
> fields on both servers - that I would understand. Any idea of what's
> changed?
It's not random. It's an accident of the implementation. Sql 2000 uses
different file structures and extensively revised and optimized
implementations of sorts and joins and whatnot. It just so happens that
these implementations return unsorted rows in a different order than SQL
6.5.
Imagine this conversation:
Programmer1: "Hey I can shave 0.05% from the CPU use for a hash join by
pushing the row pointers onto a temporary stack."
Programmer2: "But won't that reverse the order the rows are returned?"
Programmer1: "Yes but if the order is important, a subsequent ORDER BY step
will sort the rows."
Programmer2: "Cool."
David
David|||You're right - it's a moot point. Thanks again.
"David Browne" wrote:
> "SQLDeb" <SQLDeb@.discussions.microsoft.com> wrote in message
> news:C6CFDE94-0F46-474B-A9AA-CF7B2ADB6181@.microsoft.com...
> It's not random. It's an accident of the implementation. Sql 2000 uses
> different file structures and extensively revised and optimized
> implementations of sorts and joins and whatnot. It just so happens that
> these implementations return unsorted rows in a different order than SQL
> 6.5.
> Imagine this conversation:
> Programmer1: "Hey I can shave 0.05% from the CPU use for a hash join by
> pushing the row pointers onto a temporary stack."
> Programmer2: "But won't that reverse the order the rows are returned?"
> Programmer1: "Yes but if the order is important, a subsequent ORDER BY st
ep
> will sort the rows."
> Programmer2: "Cool."
> David
>
> David
>
>
Comparision test SQL 7.0 and 2000
I'm in the process of doing a compatibility test on files generated from the
same database on SQL 2000 (which is also running in 6.5 compatibility mode -
I copied it from the 7.0 server using the 2000 copy database wizard). I'm
getting different results when I create a file against test data, and don't
understand why. The file is generated from a query. The differences in the
file seem to be due to how the DirActivityLog sorts when it is matched.
The query is:
declare @.start as datetime,
@.stop as datetime
Select @.start = '03/15/05 00:01:00', @.stop = '04/15/05 00:01:00'
Select Dir.DirCode, Dir.PubCode, Dir.CountryCode,
Dir.StateCode, Dir.DirNameFull, Dir.DirNameAbbr,
Dir.FocusCode, Dir.SubCatCode, Dir.SectionFlag, dir.Action,
da.ActivityCode
from RDHistory..Directory dir (NOLOCK), DirActivityLog da (NOLOCK)
where dir.BatchRcvdDate between @.start and @.stop
and dir.CompleteFlag = 1 and
dir.DirCode *= da.DirCode and
dir.BatchRcvdDate *= da.ActivityDate
order by dir.DirCode, dir.HistID
The data contains 2 records in RDHistory..Directory for dircode 116004,
BatchRcvdDate = '3/29/05 7:00:00 AM' - the first with histid 35097 and action
'U", and the second with histid 35098 and action 'D'.
DirActivityLog contains 2 records for the same dircode 116004, with
ActivityDate = '3/29/05 7:00:00 AM' - the first record with Logid 47563 and
ActivityCode = 'N' and the second with Logid 47564 and ActivityCode 'D'.
On SQL 7.0, I get the following 4 rows with this in the DirCode, ActionCode
and ActivityCode fields:
116004,U,N
116004,U,D
116004,D,N
116004,D,D
On SQL 2000, I get the following 4 rows with this in the DirCode, ActionCode
and ActivityCode:
116004,U,N
116004,U,D
116004,D,D
116004,D,N
This changes the results written out to the end file.
The execution plans on both servers seem to be the same. The code page and
sortid used on SQL 7.0 seems compatibile with the collation used on SQL 2000.
I can solve this problem by adding more sort fields to the query, but I'd
rather not modify the application if I can help it - and I don't know why
this is occuring.
Help!
SQLDeb" <SQLDeb@.discussions.microsoft.com> wrote in message
news:FD582374-795E-4AF6-902F-9C5F76F9561A@.microsoft.com...
>I have a 6.5 compatibility mode database that is running on SQL Server 7.0.
> I'm in the process of doing a compatibility test on files generated from
> the
> same database on SQL 2000 (which is also running in 6.5 compatibility
> mode -
> I copied it from the 7.0 server using the 2000 copy database wizard). I'm
> getting different results when I create a file against test data, and
> don't
> understand why. The file is generated from a query. The differences in
> the
> file seem to be due to how the DirActivityLog sorts when it is matched.
> The query is:
> declare @.start as datetime,
> @.stop as datetime
> Select @.start = '03/15/05 00:01:00', @.stop = '04/15/05 00:01:00'
> Select Dir.DirCode, Dir.PubCode, Dir.CountryCode,
> Dir.StateCode, Dir.DirNameFull, Dir.DirNameAbbr,
> Dir.FocusCode, Dir.SubCatCode, Dir.SectionFlag, dir.Action,
> da.ActivityCode
> from RDHistory..Directory dir (NOLOCK), DirActivityLog da (NOLOCK)
> where dir.BatchRcvdDate between @.start and @.stop
> and dir.CompleteFlag = 1 and
> dir.DirCode *= da.DirCode and
> dir.BatchRcvdDate *= da.ActivityDate
> order by dir.DirCode, dir.HistID
> The data contains 2 records in RDHistory..Directory for dircode 116004,
> BatchRcvdDate = '3/29/05 7:00:00 AM' - the first with histid 35097 and
> action
> 'U", and the second with histid 35098 and action 'D'.
> DirActivityLog contains 2 records for the same dircode 116004, with
> ActivityDate = '3/29/05 7:00:00 AM' - the first record with Logid 47563
> and
> ActivityCode = 'N' and the second with Logid 47564 and ActivityCode 'D'.
> On SQL 7.0, I get the following 4 rows with this in the DirCode,
> ActionCode
> and ActivityCode fields:
> 116004,U,N
> 116004,U,D
> 116004,D,N
> 116004,D,D
> On SQL 2000, I get the following 4 rows with this in the DirCode,
> ActionCode
> and ActivityCode:
> 116004,U,N
> 116004,U,D
> 116004,D,D
> 116004,D,N
>
This is expected. Your ORDER BY does not impose a complete ordering on the
results. The first two records have HistID=35097 and the second two have
HistID=35098. Beyond that, the order is unpredictable.
You have asked the server to "order by dir.DirCode, dir.HistID", and it is.
But since multiple rows in the result can share the same (DirCode,HistID),
you have also told the server that you do not care about the ordering beyond
DirCode and HistID. Unordered rows are returned an a order which is an
accident of the implementation of the query execution. The order of these
rows was never guaranteed in SQL 6.5, and so there is no flag to force SQL
2000 to reproduce the order from 6.5.
You must decide how you want the results sorted, and force the sort order by
adding appropriate columns to the ORDER BY.
David
|||"David Browne" wrote:
> You have asked the server to "order by dir.DirCode, dir.HistID", and it is.
> But since multiple rows in the result can share the same (DirCode,HistID),
> you have also told the server that you do not care about the ordering beyond
> DirCode and HistID. Unordered rows are returned an a order which is an
> accident of the implementation of the query execution. The order of these
> rows was never guaranteed in SQL 6.5, and so there is no flag to force SQL
> 2000 to reproduce the order from 6.5.
> You must decide how you want the results sorted, and force the sort order by
> adding appropriate columns to the ORDER BY.
> David
Thanks for your quick response. I understand your point, and I can
certainly modify the order by clause in the sql statement to enforce the
order I want. However, what I don't understand is why SQL Server 7.0 would
consistently implement the sql one way, and SQL Server 2000 would
consistently implement it in another. If I got random sort results on these
fields on both servers - that I would understand. Any idea of what's changed?
|||"SQLDeb" <SQLDeb@.discussions.microsoft.com> wrote in message
news:C6CFDE94-0F46-474B-A9AA-CF7B2ADB6181@.microsoft.com...
> "David Browne" wrote:
>
> Thanks for your quick response. I understand your point, and I can
> certainly modify the order by clause in the sql statement to enforce the
> order I want. However, what I don't understand is why SQL Server 7.0
> would
> consistently implement the sql one way, and SQL Server 2000 would
> consistently implement it in another. If I got random sort results on
> these
> fields on both servers - that I would understand. Any idea of what's
> changed?
It's not random. It's an accident of the implementation. Sql 2000 uses
different file structures and extensively revised and optimized
implementations of sorts and joins and whatnot. It just so happens that
these implementations return unsorted rows in a different order than SQL
6.5.
Imagine this conversation:
Programmer1: "Hey I can shave 0.05% from the CPU use for a hash join by
pushing the row pointers onto a temporary stack."
Programmer2: "But won't that reverse the order the rows are returned?"
Programmer1: "Yes but if the order is important, a subsequent ORDER BY step
will sort the rows."
Programmer2: "Cool."
David
David
|||You're right - it's a moot point. Thanks again.
"David Browne" wrote:
> "SQLDeb" <SQLDeb@.discussions.microsoft.com> wrote in message
> news:C6CFDE94-0F46-474B-A9AA-CF7B2ADB6181@.microsoft.com...
> It's not random. It's an accident of the implementation. Sql 2000 uses
> different file structures and extensively revised and optimized
> implementations of sorts and joins and whatnot. It just so happens that
> these implementations return unsorted rows in a different order than SQL
> 6.5.
> Imagine this conversation:
> Programmer1: "Hey I can shave 0.05% from the CPU use for a hash join by
> pushing the row pointers onto a temporary stack."
> Programmer2: "But won't that reverse the order the rows are returned?"
> Programmer1: "Yes but if the order is important, a subsequent ORDER BY step
> will sort the rows."
> Programmer2: "Cool."
> David
>
> David
>
>
Comparision test SQL 7.0 and 2000
I'm in the process of doing a compatibility test on files generated from the
same database on SQL 2000 (which is also running in 6.5 compatibility mode -
I copied it from the 7.0 server using the 2000 copy database wizard). I'm
getting different results when I create a file against test data, and don't
understand why. The file is generated from a query. The differences in the
file seem to be due to how the DirActivityLog sorts when it is matched.
The query is:
declare @.start as datetime,
@.stop as datetime
Select @.start = '03/15/05 00:01:00', @.stop = '04/15/05 00:01:00'
Select Dir.DirCode, Dir.PubCode, Dir.CountryCode,
Dir.StateCode, Dir.DirNameFull, Dir.DirNameAbbr,
Dir.FocusCode, Dir.SubCatCode, Dir.SectionFlag, dir.Action,
da.ActivityCode
from RDHistory..Directory dir (NOLOCK), DirActivityLog da (NOLOCK)
where dir.BatchRcvdDate between @.start and @.stop
and dir.CompleteFlag = 1 and
dir.DirCode *= da.DirCode and
dir.BatchRcvdDate *= da.ActivityDate
order by dir.DirCode, dir.HistID
The data contains 2 records in RDHistory..Directory for dircode 116004,
BatchRcvdDate = '3/29/05 7:00:00 AM' - the first with histid 35097 and action
'U", and the second with histid 35098 and action 'D'.
DirActivityLog contains 2 records for the same dircode 116004, with
ActivityDate = '3/29/05 7:00:00 AM' - the first record with Logid 47563 and
ActivityCode = 'N' and the second with Logid 47564 and ActivityCode 'D'.
On SQL 7.0, I get the following 4 rows with this in the DirCode, ActionCode
and ActivityCode fields:
116004,U,N
116004,U,D
116004,D,N
116004,D,D
On SQL 2000, I get the following 4 rows with this in the DirCode, ActionCode
and ActivityCode:
116004,U,N
116004,U,D
116004,D,D
116004,D,N
This changes the results written out to the end file.
The execution plans on both servers seem to be the same. The code page and
sortid used on SQL 7.0 seems compatibile with the collation used on SQL 2000.
I can solve this problem by adding more sort fields to the query, but I'd
rather not modify the application if I can help it - and I don't know why
this is occuring.
Help!SQLDeb" <SQLDeb@.discussions.microsoft.com> wrote in message
news:FD582374-795E-4AF6-902F-9C5F76F9561A@.microsoft.com...
>I have a 6.5 compatibility mode database that is running on SQL Server 7.0.
> I'm in the process of doing a compatibility test on files generated from
> the
> same database on SQL 2000 (which is also running in 6.5 compatibility
> mode -
> I copied it from the 7.0 server using the 2000 copy database wizard). I'm
> getting different results when I create a file against test data, and
> don't
> understand why. The file is generated from a query. The differences in
> the
> file seem to be due to how the DirActivityLog sorts when it is matched.
> The query is:
> declare @.start as datetime,
> @.stop as datetime
> Select @.start = '03/15/05 00:01:00', @.stop = '04/15/05 00:01:00'
> Select Dir.DirCode, Dir.PubCode, Dir.CountryCode,
> Dir.StateCode, Dir.DirNameFull, Dir.DirNameAbbr,
> Dir.FocusCode, Dir.SubCatCode, Dir.SectionFlag, dir.Action,
> da.ActivityCode
> from RDHistory..Directory dir (NOLOCK), DirActivityLog da (NOLOCK)
> where dir.BatchRcvdDate between @.start and @.stop
> and dir.CompleteFlag = 1 and
> dir.DirCode *= da.DirCode and
> dir.BatchRcvdDate *= da.ActivityDate
> order by dir.DirCode, dir.HistID
> The data contains 2 records in RDHistory..Directory for dircode 116004,
> BatchRcvdDate = '3/29/05 7:00:00 AM' - the first with histid 35097 and
> action
> 'U", and the second with histid 35098 and action 'D'.
> DirActivityLog contains 2 records for the same dircode 116004, with
> ActivityDate = '3/29/05 7:00:00 AM' - the first record with Logid 47563
> and
> ActivityCode = 'N' and the second with Logid 47564 and ActivityCode 'D'.
> On SQL 7.0, I get the following 4 rows with this in the DirCode,
> ActionCode
> and ActivityCode fields:
> 116004,U,N
> 116004,U,D
> 116004,D,N
> 116004,D,D
> On SQL 2000, I get the following 4 rows with this in the DirCode,
> ActionCode
> and ActivityCode:
> 116004,U,N
> 116004,U,D
> 116004,D,D
> 116004,D,N
>
This is expected. Your ORDER BY does not impose a complete ordering on the
results. The first two records have HistID=35097 and the second two have
HistID=35098. Beyond that, the order is unpredictable.
You have asked the server to "order by dir.DirCode, dir.HistID", and it is.
But since multiple rows in the result can share the same (DirCode,HistID),
you have also told the server that you do not care about the ordering beyond
DirCode and HistID. Unordered rows are returned an a order which is an
accident of the implementation of the query execution. The order of these
rows was never guaranteed in SQL 6.5, and so there is no flag to force SQL
2000 to reproduce the order from 6.5.
You must decide how you want the results sorted, and force the sort order by
adding appropriate columns to the ORDER BY.
David|||"David Browne" wrote:
> You have asked the server to "order by dir.DirCode, dir.HistID", and it is.
> But since multiple rows in the result can share the same (DirCode,HistID),
> you have also told the server that you do not care about the ordering beyond
> DirCode and HistID. Unordered rows are returned an a order which is an
> accident of the implementation of the query execution. The order of these
> rows was never guaranteed in SQL 6.5, and so there is no flag to force SQL
> 2000 to reproduce the order from 6.5.
> You must decide how you want the results sorted, and force the sort order by
> adding appropriate columns to the ORDER BY.
> David
Thanks for your quick response. I understand your point, and I can
certainly modify the order by clause in the sql statement to enforce the
order I want. However, what I don't understand is why SQL Server 7.0 would
consistently implement the sql one way, and SQL Server 2000 would
consistently implement it in another. If I got random sort results on these
fields on both servers - that I would understand. Any idea of what's changed?|||"SQLDeb" <SQLDeb@.discussions.microsoft.com> wrote in message
news:C6CFDE94-0F46-474B-A9AA-CF7B2ADB6181@.microsoft.com...
> "David Browne" wrote:
>> You have asked the server to "order by dir.DirCode, dir.HistID", and it
>> is.
>> But since multiple rows in the result can share the same
>> (DirCode,HistID),
>> you have also told the server that you do not care about the ordering
>> beyond
>> DirCode and HistID. Unordered rows are returned an a order which is an
>> accident of the implementation of the query execution. The order of these
>> rows was never guaranteed in SQL 6.5, and so there is no flag to force
>> SQL
>> 2000 to reproduce the order from 6.5.
>> You must decide how you want the results sorted, and force the sort order
>> by
>> adding appropriate columns to the ORDER BY.
>> David
> Thanks for your quick response. I understand your point, and I can
> certainly modify the order by clause in the sql statement to enforce the
> order I want. However, what I don't understand is why SQL Server 7.0
> would
> consistently implement the sql one way, and SQL Server 2000 would
> consistently implement it in another. If I got random sort results on
> these
> fields on both servers - that I would understand. Any idea of what's
> changed?
It's not random. It's an accident of the implementation. Sql 2000 uses
different file structures and extensively revised and optimized
implementations of sorts and joins and whatnot. It just so happens that
these implementations return unsorted rows in a different order than SQL
6.5.
Imagine this conversation:
Programmer1: "Hey I can shave 0.05% from the CPU use for a hash join by
pushing the row pointers onto a temporary stack."
Programmer2: "But won't that reverse the order the rows are returned?"
Programmer1: "Yes but if the order is important, a subsequent ORDER BY step
will sort the rows."
Programmer2: "Cool."
David
David|||You're right - it's a moot point. Thanks again.
"David Browne" wrote:
> "SQLDeb" <SQLDeb@.discussions.microsoft.com> wrote in message
> news:C6CFDE94-0F46-474B-A9AA-CF7B2ADB6181@.microsoft.com...
> > "David Browne" wrote:
> >
> >> You have asked the server to "order by dir.DirCode, dir.HistID", and it
> >> is.
> >> But since multiple rows in the result can share the same
> >> (DirCode,HistID),
> >> you have also told the server that you do not care about the ordering
> >> beyond
> >> DirCode and HistID. Unordered rows are returned an a order which is an
> >> accident of the implementation of the query execution. The order of these
> >> rows was never guaranteed in SQL 6.5, and so there is no flag to force
> >> SQL
> >> 2000 to reproduce the order from 6.5.
> >>
> >> You must decide how you want the results sorted, and force the sort order
> >> by
> >> adding appropriate columns to the ORDER BY.
> >>
> >> David
> >
> > Thanks for your quick response. I understand your point, and I can
> > certainly modify the order by clause in the sql statement to enforce the
> > order I want. However, what I don't understand is why SQL Server 7.0
> > would
> > consistently implement the sql one way, and SQL Server 2000 would
> > consistently implement it in another. If I got random sort results on
> > these
> > fields on both servers - that I would understand. Any idea of what's
> > changed?
> It's not random. It's an accident of the implementation. Sql 2000 uses
> different file structures and extensively revised and optimized
> implementations of sorts and joins and whatnot. It just so happens that
> these implementations return unsorted rows in a different order than SQL
> 6.5.
> Imagine this conversation:
> Programmer1: "Hey I can shave 0.05% from the CPU use for a hash join by
> pushing the row pointers onto a temporary stack."
> Programmer2: "But won't that reverse the order the rows are returned?"
> Programmer1: "Yes but if the order is important, a subsequent ORDER BY step
> will sort the rows."
> Programmer2: "Cool."
> David
>
> David
>
>
Comparision on Char Column With Alphanumeric Values
I am using SQL Server 2000.
I have a table which a column ID(Char(13)). The column has values varying
from BBB, AAA, , 432990098C,432990164C, 4329999999999 and so on. When i try
to retrieve records from the
table using a query like
Select * From myTable Where Id >='43299AAAAAAAA' AND Id<='4329999999999'
The query returns 0 records, whereas ideally it should return records with
values like '432999098C','432990164C' and so on.
I have tried all the different collations on the table column but with no
success.
Can some sql guru help me on this.
TIACheck your expression again - look at this:
IF '43299AAAAAAAA' <= '4329999999999'
PRINT 'True'
ELSE
PRINT 'False'
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"Vaibhav" <consultvaibhav@.yahoo.com> wrote in message
news:OeV6ZIGwEHA.200@.TK2MSFTNGP11.phx.gbl...
> Hi All
> I am using SQL Server 2000.
> I have a table which a column ID(Char(13)). The column has values varying
> from BBB, AAA, , 432990098C,432990164C, 4329999999999 and so on. When i
try
> to retrieve records from the
> table using a query like
> Select * From myTable Where Id >='43299AAAAAAAA' AND Id<='4329999999999'
> The query returns 0 records, whereas ideally it should return records with
> values like '432999098C','432990164C' and so on.
> I have tried all the different collations on the table column but with no
> success.
> Can some sql guru help me on this.
> TIA
>|||Thank you for the reponse and you are right the expression would always
evaluate to false and therfore no records are returned.
But the same type of expressions evalutes to true when executed against a
IBM-DB2 database ans returns records as required, Why is that ?
Is there any way where the expression as mentioned by you, would evaluate to
'True' in MS-SQL server and thus return records.
TIA
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in
message news:OxD9rjKwEHA.4004@.tk2msftngp13.phx.gbl...
> Check your expression again - look at this:
> IF '43299AAAAAAAA' <= '4329999999999'
> PRINT 'True'
> ELSE
> PRINT 'False'
> --
> Dejan Sarka, SQL Server MVP
> Associate Mentor
> www.SolidQualityLearning.com
> "Vaibhav" <consultvaibhav@.yahoo.com> wrote in message
> news:OeV6ZIGwEHA.200@.TK2MSFTNGP11.phx.gbl...
> try
>|||I guess there must be some sort order where alfa characters have lower ASCII
number that numbers.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"Vaibhav" <consultvaibhav@.yahoo.com> wrote in message
news:uqIlscOwEHA.356@.TK2MSFTNGP10.phx.gbl...
> Thank you for the reponse and you are right the expression would always
> evaluate to false and therfore no records are returned.
> But the same type of expressions evalutes to true when executed against a
> IBM-DB2 database ans returns records as required, Why is that ?
> Is there any way where the expression as mentioned by you, would evaluate
to
> 'True' in MS-SQL server and thus return records.
> TIA
>
> "Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in
> message news:OxD9rjKwEHA.4004@.tk2msftngp13.phx.gbl...
varying[vbcol=seagreen]
Id<='4329999999999'[vbcol=seagreen]
no[vbcol=seagreen]
>|||IF '43299AAAAAAAA' <= '4329999999999' collate SQL_EBCDIC273_CP1_CS_AS
PRINT 'True'
ELSE
PRINT 'False'
I have no idea what the EBCDIC collations do in detail, but they at
least answer this question to the poster's satisfaction.
SK
Dejan Sarka wrote:
>I guess there must be some sort order where alfa characters have lower ASCI
I
>number that numbers.
>
>|||THANKS A LOT !!!!!!!!!
SALUTE THE GURU!
"Steve Kass" <skass@.drew.edu> wrote in message
news:4187B2F1.8030001@.drew.edu...[vbcol=seagreen]
> IF '43299AAAAAAAA' <= '4329999999999' collate SQL_EBCDIC273_CP1_CS_AS
> PRINT 'True'
> ELSE
> PRINT 'False'
> I have no idea what the EBCDIC collations do in detail, but they at least
> answer this question to the poster's satisfaction.
> SK
> Dejan Sarka wrote:
>
Comparision on Char Column With Alphanumeric Values
I am using SQL Server 2000.
I have a table which a column ID(Char(13)). The column has values varying
from BBB, AAA, , 432990098C,432990164C, 4329999999999 and so on. When i try
to retrieve records from the
table using a query like
Select * From myTable Where Id >='43299AAAAAAAA' AND Id<='4329999999999'
The query returns 0 records, whereas ideally it should return records with
values like '432999098C','432990164C' and so on.
I have tried all the different collations on the table column but with no
success.
Can some sql guru help me on this.
TIA
Check your expression again - look at this:
IF '43299AAAAAAAA' <= '4329999999999'
PRINT 'True'
ELSE
PRINT 'False'
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"Vaibhav" <consultvaibhav@.yahoo.com> wrote in message
news:OeV6ZIGwEHA.200@.TK2MSFTNGP11.phx.gbl...
> Hi All
> I am using SQL Server 2000.
> I have a table which a column ID(Char(13)). The column has values varying
> from BBB, AAA, , 432990098C,432990164C, 4329999999999 and so on. When i
try
> to retrieve records from the
> table using a query like
> Select * From myTable Where Id >='43299AAAAAAAA' AND Id<='4329999999999'
> The query returns 0 records, whereas ideally it should return records with
> values like '432999098C','432990164C' and so on.
> I have tried all the different collations on the table column but with no
> success.
> Can some sql guru help me on this.
> TIA
>
|||Thank you for the reponse and you are right the expression would always
evaluate to false and therfore no records are returned.
But the same type of expressions evalutes to true when executed against a
IBM-DB2 database ans returns records as required, Why is that ?
Is there any way where the expression as mentioned by you, would evaluate to
'True' in MS-SQL server and thus return records.
TIA
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si > wrote in
message news:OxD9rjKwEHA.4004@.tk2msftngp13.phx.gbl...
> Check your expression again - look at this:
> IF '43299AAAAAAAA' <= '4329999999999'
> PRINT 'True'
> ELSE
> PRINT 'False'
> --
> Dejan Sarka, SQL Server MVP
> Associate Mentor
> www.SolidQualityLearning.com
> "Vaibhav" <consultvaibhav@.yahoo.com> wrote in message
> news:OeV6ZIGwEHA.200@.TK2MSFTNGP11.phx.gbl...
> try
>
|||I guess there must be some sort order where alfa characters have lower ASCII
number that numbers.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"Vaibhav" <consultvaibhav@.yahoo.com> wrote in message
news:uqIlscOwEHA.356@.TK2MSFTNGP10.phx.gbl...
> Thank you for the reponse and you are right the expression would always
> evaluate to false and therfore no records are returned.
> But the same type of expressions evalutes to true when executed against a
> IBM-DB2 database ans returns records as required, Why is that ?
> Is there any way where the expression as mentioned by you, would evaluate
to[vbcol=seagreen]
> 'True' in MS-SQL server and thus return records.
> TIA
>
> "Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si > wrote in
> message news:OxD9rjKwEHA.4004@.tk2msftngp13.phx.gbl...
varying[vbcol=seagreen]
Id<='4329999999999'[vbcol=seagreen]
no
>
|||IF '43299AAAAAAAA' <= '4329999999999' collate SQL_EBCDIC273_CP1_CS_AS
PRINT 'True'
ELSE
PRINT 'False'
I have no idea what the EBCDIC collations do in detail, but they at
least answer this question to the poster's satisfaction.
SK
Dejan Sarka wrote:
>I guess there must be some sort order where alfa characters have lower ASCII
>number that numbers.
>
>
|||THANKS A LOT !!!!!!!!!
SALUTE THE GURU!
"Steve Kass" <skass@.drew.edu> wrote in message
news:4187B2F1.8030001@.drew.edu...[vbcol=seagreen]
> IF '43299AAAAAAAA' <= '4329999999999' collate SQL_EBCDIC273_CP1_CS_AS
> PRINT 'True'
> ELSE
> PRINT 'False'
> I have no idea what the EBCDIC collations do in detail, but they at least
> answer this question to the poster's satisfaction.
> SK
> Dejan Sarka wrote:
Comparision on Char Column With Alphanumeric Values
I am using SQL Server 2000.
I have a table which a column ID(Char(13)). The column has values varying
from BBB, AAA, , 432990098C,432990164C, 4329999999999 and so on. When i try
to retrieve records from the
table using a query like
Select * From myTable Where Id >='43299AAAAAAAA' AND Id<='4329999999999'
The query returns 0 records, whereas ideally it should return records with
values like '432999098C','432990164C' and so on.
I have tried all the different collations on the table column but with no
success.
Can some sql guru help me on this.
TIACheck your expression again - look at this:
IF '43299AAAAAAAA' <= '4329999999999'
PRINT 'True'
ELSE
PRINT 'False'
--
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"Vaibhav" <consultvaibhav@.yahoo.com> wrote in message
news:OeV6ZIGwEHA.200@.TK2MSFTNGP11.phx.gbl...
> Hi All
> I am using SQL Server 2000.
> I have a table which a column ID(Char(13)). The column has values varying
> from BBB, AAA, , 432990098C,432990164C, 4329999999999 and so on. When i
try
> to retrieve records from the
> table using a query like
> Select * From myTable Where Id >='43299AAAAAAAA' AND Id<='4329999999999'
> The query returns 0 records, whereas ideally it should return records with
> values like '432999098C','432990164C' and so on.
> I have tried all the different collations on the table column but with no
> success.
> Can some sql guru help me on this.
> TIA
>|||Thank you for the reponse and you are right the expression would always
evaluate to false and therfore no records are returned.
But the same type of expressions evalutes to true when executed against a
IBM-DB2 database ans returns records as required, Why is that ?
Is there any way where the expression as mentioned by you, would evaluate to
'True' in MS-SQL server and thus return records.
TIA
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in
message news:OxD9rjKwEHA.4004@.tk2msftngp13.phx.gbl...
> Check your expression again - look at this:
> IF '43299AAAAAAAA' <= '4329999999999'
> PRINT 'True'
> ELSE
> PRINT 'False'
> --
> Dejan Sarka, SQL Server MVP
> Associate Mentor
> www.SolidQualityLearning.com
> "Vaibhav" <consultvaibhav@.yahoo.com> wrote in message
> news:OeV6ZIGwEHA.200@.TK2MSFTNGP11.phx.gbl...
>> Hi All
>> I am using SQL Server 2000.
>> I have a table which a column ID(Char(13)). The column has values varying
>> from BBB, AAA, , 432990098C,432990164C, 4329999999999 and so on. When i
> try
>> to retrieve records from the
>> table using a query like
>> Select * From myTable Where Id >='43299AAAAAAAA' AND Id<='4329999999999'
>> The query returns 0 records, whereas ideally it should return records
>> with
>> values like '432999098C','432990164C' and so on.
>> I have tried all the different collations on the table column but with no
>> success.
>> Can some sql guru help me on this.
>> TIA
>>
>|||I guess there must be some sort order where alfa characters have lower ASCII
number that numbers.
--
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"Vaibhav" <consultvaibhav@.yahoo.com> wrote in message
news:uqIlscOwEHA.356@.TK2MSFTNGP10.phx.gbl...
> Thank you for the reponse and you are right the expression would always
> evaluate to false and therfore no records are returned.
> But the same type of expressions evalutes to true when executed against a
> IBM-DB2 database ans returns records as required, Why is that ?
> Is there any way where the expression as mentioned by you, would evaluate
to
> 'True' in MS-SQL server and thus return records.
> TIA
>
> "Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in
> message news:OxD9rjKwEHA.4004@.tk2msftngp13.phx.gbl...
> > Check your expression again - look at this:
> >
> > IF '43299AAAAAAAA' <= '4329999999999'
> > PRINT 'True'
> > ELSE
> > PRINT 'False'
> >
> > --
> > Dejan Sarka, SQL Server MVP
> > Associate Mentor
> > www.SolidQualityLearning.com
> >
> > "Vaibhav" <consultvaibhav@.yahoo.com> wrote in message
> > news:OeV6ZIGwEHA.200@.TK2MSFTNGP11.phx.gbl...
> >> Hi All
> >>
> >> I am using SQL Server 2000.
> >>
> >> I have a table which a column ID(Char(13)). The column has values
varying
> >> from BBB, AAA, , 432990098C,432990164C, 4329999999999 and so on. When i
> > try
> >> to retrieve records from the
> >> table using a query like
> >>
> >> Select * From myTable Where Id >='43299AAAAAAAA' AND
Id<='4329999999999'
> >>
> >> The query returns 0 records, whereas ideally it should return records
> >> with
> >> values like '432999098C','432990164C' and so on.
> >>
> >> I have tried all the different collations on the table column but with
no
> >> success.
> >>
> >> Can some sql guru help me on this.
> >>
> >> TIA
> >>
> >>
> >
> >
>|||IF '43299AAAAAAAA' <= '4329999999999' collate SQL_EBCDIC273_CP1_CS_AS
PRINT 'True'
ELSE
PRINT 'False'
I have no idea what the EBCDIC collations do in detail, but they at
least answer this question to the poster's satisfaction.
SK
Dejan Sarka wrote:
>I guess there must be some sort order where alfa characters have lower ASCII
>number that numbers.
>
>|||THANKS A LOT !!!!!!!!!
SALUTE THE GURU!
"Steve Kass" <skass@.drew.edu> wrote in message
news:4187B2F1.8030001@.drew.edu...
> IF '43299AAAAAAAA' <= '4329999999999' collate SQL_EBCDIC273_CP1_CS_AS
> PRINT 'True'
> ELSE
> PRINT 'False'
> I have no idea what the EBCDIC collations do in detail, but they at least
> answer this question to the poster's satisfaction.
> SK
> Dejan Sarka wrote:
>>I guess there must be some sort order where alfa characters have lower
>>ASCII
>>number that numbers.
>>
comparision of sql server & mysql
storedprocedures,stored functions and views.> whats the difference betwwen mysql and sql server2000 in terms of using
> storedprocedures,stored functions and views.
What version of MySQL?
--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com|||MYSql 5.0|||> MYSql 5.0
Well, both MySQL 5 and SQL Server 2000 have views/procedures/functions.
SQL Server 2000 has Check Constraints, which MySQL doesn't.
From SQL Server 2000, it's quite easy to extend the server with
stuff that's accessible from TSQL (like COM objects and so on)
in a programming language that supports it.
MySQL uses the standard PSM (Persistent Stored Module) Syntax for
it's procedures and functions, while SQL Server uses T-SQL, a Microsoft
extension to standard SQL.
Is there anything specific that you want to know?
--
Martijn Tonies
Database Workbench - development tool for MySQL, and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
Comparision of SQL 2000 & 2005
2005. Like any website where I can find the enhacement like
1)
SQL Server 2005 :
We can pass the dynamic value of top in the
procedure.
Select Top @.Top from Table
SQL Server 2000 :
We can't you this and for implementing this we
have to make dynamic query.
2) Datatype :
Date in SQL Server 2005
Time in SQL Server 2005
XML in SQL Server 2005
Varchar(8000) in SQL Server 2000
Varchar(MAX) in SQL Server 2005
Can any one let me know like this sort of comparion I can find in which
website?
Thanks
If you install the SQL Server 2005 beta builds Books OnLine, there's a
section that covers "What's New in SQL Server 2005" for various components
including relational engine, TSQL, Replication, Analysis Services,
Management, Security, etc...
You can download the latest beta/Community Tech Preview from
http://www.microsoft.com/sql/2005/productinfo/ctp.mspx
joe.
"Roy" <roy@.hotmail.com> wrote in message
news:%23legtHAjFHA.576@.TK2MSFTNGP15.phx.gbl...
> Can any one tell me about the comparision of SQL Server 2000 & SQL Server
> 2005. Like any website where I can find the enhacement like
> 1)
> SQL Server 2005 :
> We can pass the dynamic value of top in the
> procedure.
> Select Top @.Top from Table
> SQL Server 2000 :
> We can't you this and for implementing this we
> have to make dynamic query.
>
> 2) Datatype :
> Date in SQL Server 2005
> Time in SQL Server 2005
> XML in SQL Server 2005
> Varchar(8000) in SQL Server 2000
> Varchar(MAX) in SQL Server 2005
>
> Can any one let me know like this sort of comparion I can find in which
> website?
> Thanks
>
>
>
Comparision of features of SQL Server 2005 editions
Thankshttp://www.microsoft.com/sql/prodin...e-features.mspx
HTH,
Greg
<shahdharti@.gmail.com> wrote in message
news:1136962712.097286.167230@.g47g2000cwa.googlegroups.com...
> How can I find Comparison of features of SQL Server 2005 editions.
> Thanks
>|||Thanks
Thats what I want.
One more question if I want to upgrade from 32 bit to 64 bit will I get
any discount in licence fee?|||My guess is that could even vary between countries. I'd talk to your local
sales folk.
Regards,
Greg
<shahdharti@.gmail.com> wrote in message
news:1136966241.108786.26820@.o13g2000cwo.googlegroups.com...
> Thanks
> Thats what I want.
> One more question if I want to upgrade from 32 bit to 64 bit will I get
> any discount in licence fee?
>
Comparision of features of SQL Server 2005 editions
Thanks
http://www.microsoft.com/sql/prodinf...-features.mspx
HTH,
Greg
<shahdharti@.gmail.com> wrote in message
news:1136962712.097286.167230@.g47g2000cwa.googlegr oups.com...
> How can I find Comparison of features of SQL Server 2005 editions.
> Thanks
>
|||Thanks
Thats what I want.
One more question if I want to upgrade from 32 bit to 64 bit will I get
any discount in licence fee?
|||My guess is that could even vary between countries. I'd talk to your local
sales folk.
Regards,
Greg
<shahdharti@.gmail.com> wrote in message
news:1136966241.108786.26820@.o13g2000cwo.googlegro ups.com...
> Thanks
> Thats what I want.
> One more question if I want to upgrade from 32 bit to 64 bit will I get
> any discount in licence fee?
>
Comparision of features of SQL Server 2005 editions
Thankshttp://www.microsoft.com/sql/prodinfo/features/compare-features.mspx
HTH,
Greg
<shahdharti@.gmail.com> wrote in message
news:1136962712.097286.167230@.g47g2000cwa.googlegroups.com...
> How can I find Comparison of features of SQL Server 2005 editions.
> Thanks
>|||Thanks
Thats what I want.
One more question if I want to upgrade from 32 bit to 64 bit will I get
any discount in licence fee?|||My guess is that could even vary between countries. I'd talk to your local
sales folk.
Regards,
Greg
<shahdharti@.gmail.com> wrote in message
news:1136966241.108786.26820@.o13g2000cwo.googlegroups.com...
> Thanks
> Thats what I want.
> One more question if I want to upgrade from 32 bit to 64 bit will I get
> any discount in licence fee?
>
comparision filter on a float field
error
> Expression =Fields!float_cal.Value
> Operator <= > Value =0
I keep getting the error 'check data type returned'. I tried
> Expression =CInt(Fields!float_cal.Value )
but this did not work either.
Any ideasHi Marg,
if it is a float field you should convert it to double, not integer.
Try Expression = Cdbl(Fields!float_cal.Value ).
If that does not work you could even try cdbl(Expression) =Cdbl(Fields!float_cal.Value ).
Best regards,
Stefan
"marg" wrote:
> I'm trying to do a comparision filter on a float field and I keep getting the
> error
> > Expression =Fields!float_cal.Value
> > Operator <=> > Value =0
> I keep getting the error 'check data type returned'. I tried
> > Expression =CInt(Fields!float_cal.Value )
> but this did not work either.
> Any ideas
>