Showing posts with label running. Show all posts
Showing posts with label running. Show all posts

Sunday, March 25, 2012

Computerrename

Hello,
I have a small question. We have an cluster (W2K) running with an
SQL2000 and an IIS on it. Is it possible to rename the notes of the
cluster without any problems?
Greetings
Stefan
Your best method for renaming cluster nodes is to fail every thing across to
one of the nodes. Then remove the node with no resources from the cluster and
then rename it. After it has been renamed join the node back to the cluster
move the resources across to the renamed node and repeat the process with the
second node.
Thanks
Mark
"Stefan Oswald" wrote:

> Hello,
> I have a small question. We have an cluster (W2K) running with an
> SQL2000 and an IIS on it. Is it possible to rename the notes of the
> cluster without any problems?
> Greetings
> Stefan
>
|||Mark, have you tried this yet? I am not aware of any supported method of
renaming a SQL server (clustered or not).
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering Website
http://www.msmvps.com/clustering - Blog
http://www.clusterhelp.com - Cluster Training
"Mark Bradley" <MarkBradley@.discussions.microsoft.com> wrote in message
news:8C1A89C9-16CE-4467-A770-721197B4A7EF@.microsoft.com...[vbcol=seagreen]
> Your best method for renaming cluster nodes is to fail every thing across
> to
> one of the nodes. Then remove the node with no resources from the cluster
> and
> then rename it. After it has been renamed join the node back to the
> cluster
> move the resources across to the renamed node and repeat the process with
> the
> second node.
> Thanks
> Mark
>
> "Stefan Oswald" wrote:
|||He left off the little detail of uninstalling and reinstalling SQL on the
newly renamed node.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Rodney R. Fournier [MVP]" <rod@.die.spam.die.nw-america.com> wrote in
message news:eTfZnls5FHA.3636@.TK2MSFTNGP09.phx.gbl...
> Mark, have you tried this yet? I am not aware of any supported method of
> renaming a SQL server (clustered or not).
> Cheers,
> Rod
> MVP - Windows Server - Clustering
> http://www.nw-america.com - Clustering Website
> http://www.msmvps.com/clustering - Blog
> http://www.clusterhelp.com - Cluster Training
>
> "Mark Bradley" <MarkBradley@.discussions.microsoft.com> wrote in message
> news:8C1A89C9-16CE-4467-A770-721197B4A7EF@.microsoft.com...
>
|||Ok, in that case, his method will work nicely
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering Website
http://www.msmvps.com/clustering - Blog
http://www.clusterhelp.com - Cluster Training
"Geoff N. Hiten" <sqlcraftsman@.gmail.com> wrote in message
news:eJJfPBt5FHA.1864@.TK2MSFTNGP12.phx.gbl...
> He left off the little detail of uninstalling and reinstalling SQL on the
> newly renamed node.
> --
> Geoff N. Hiten
> Senior Database Administrator
> Microsoft SQL Server MVP
> "Rodney R. Fournier [MVP]" <rod@.die.spam.die.nw-america.com> wrote in
> message news:eTfZnls5FHA.3636@.TK2MSFTNGP09.phx.gbl...
>
|||In this case it looked like it was not the instance being renamed only the
nodes name in which case the SQL instance would remain unchanged. Exactley
the same as if you added a new node to a cluster.
Your correct that you have to reinstall to rename the instance but it is
easier and safer to add a new virtual server instance and migrate the data.
As for standalone SQL you can rename it but it can cause problems with any
code using specified name.
Example in books online is incorrect correct article below
http://support.microsoft.com/default...b;en-us;303774
Cheers
Mark
"Rodney R. Fournier [MVP]" wrote:

> Ok, in that case, his method will work nicely
> Cheers,
> Rod
> MVP - Windows Server - Clustering
> http://www.nw-america.com - Clustering Website
> http://www.msmvps.com/clustering - Blog
> http://www.clusterhelp.com - Cluster Training
>
> "Geoff N. Hiten" <sqlcraftsman@.gmail.com> wrote in message
> news:eJJfPBt5FHA.1864@.TK2MSFTNGP12.phx.gbl...
>
>

Thursday, March 22, 2012

Computed Column

Is there a query that can be run to return all the tables in a database that
contain a computed column?
We are running SQL 2005, SP1, on Windows 2003.
Message posted via droptable.com
http://www.droptable.com/Uwe/Forums.aspx/sql-server/200612/1
SELECT DISTINCT object_name(object_id)
FROM sys.computed_columns
Roy Harvey
Beacon Falls, CT
On Fri, 01 Dec 2006 21:38:16 GMT, "cbrichards via droptable.com"
<u3288@.uwe> wrote:

>Is there a query that can be run to return all the tables in a database that
>contain a computed column?
>We are running SQL 2005, SP1, on Windows 2003.

Computed Column

Is there a query that can be run to return all the tables in a database that
contain a computed column?
We are running SQL 2005, SP1, on Windows 2003.
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...server/200612/1SELECT DISTINCT object_name(object_id)
FROM sys.computed_columns
Roy Harvey
Beacon Falls, CT
On Fri, 01 Dec 2006 21:38:16 GMT, "cbrichards via droptable.com"
<u3288@.uwe> wrote:

>Is there a query that can be run to return all the tables in a database tha
t
>contain a computed column?
>We are running SQL 2005, SP1, on Windows 2003.

Computed Column

Is there a query that can be run to return all the tables in a database that
contain a computed column?
We are running SQL 2005, SP1, on Windows 2003.
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200612/1SELECT DISTINCT object_name(object_id)
FROM sys.computed_columns
Roy Harvey
Beacon Falls, CT
On Fri, 01 Dec 2006 21:38:16 GMT, "cbrichards via SQLMonster.com"
<u3288@.uwe> wrote:
>Is there a query that can be run to return all the tables in a database that
>contain a computed column?
>We are running SQL 2005, SP1, on Windows 2003.

Tuesday, March 20, 2012

Compound Statements

Hello,

How can I stop/prevent SQL server from running compound SQL
statements. I do not want the server to run multiple
update/delete/insert/select statements as a batch. Is there an option?

/Kaf
www.afiouni.comKhaled Afiouni (post@.afiouni.com) writes:
> How can I stop/prevent SQL server from running compound SQL
> statements. I do not want the server to run multiple
> update/delete/insert/select statements as a batch. Is there an option?

No, there is no such option.

Please explain what your real problem is, and maybe we can find a
suggestion. What you are asking for right now does not really make sense?

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||The usual mechanism to restrict what operations users can perform is to give
them access only through parameterized stored procedures. Does that not meet
your requirements?

--
David Portas
SQL Server MVP
--|||Erland Sommarskog <esquel@.sommarskog.se> wrote in message news:<Xns951F7F821DCD5Yazorman@.127.0.0.1>...
> Khaled Afiouni (post@.afiouni.com) writes:
> > How can I stop/prevent SQL server from running compound SQL
> > statements. I do not want the server to run multiple
> > update/delete/insert/select statements as a batch. Is there an option?
> No, there is no such option.
> Please explain what your real problem is, and maybe we can find a
> suggestion. What you are asking for right now does not really make sense?

Thank you for your reply. Please allow me to simplify it.

Actually I am checking for an ultimate solution to the SQL injection
issues. So in addition to filtering, checking and validating the
input, I would like to stop the compound statements from running and
allowing only the first SQL statements to be executed.

Any suggestions?

/Kaf
www.afiouni.com|||Erland Sommarskog <esquel@.sommarskog.se> wrote in message news:<Xns951F7F821DCD5Yazorman@.127.0.0.1>...
> Khaled Afiouni (post@.afiouni.com) writes:
> > How can I stop/prevent SQL server from running compound SQL
> > statements. I do not want the server to run multiple
> > update/delete/insert/select statements as a batch. Is there an option?
> No, there is no such option.
> Please explain what your real problem is, and maybe we can find a
> suggestion. What you are asking for right now does not really make sense?

Thank you very much for your reply.

I am trying to find an ultimate solution to the SQL injection issues.
In addition to verifying, validating and checking on the data entry
fields, I would like to prevent compound statements from running and
only allowing the first SQL statement to run.

Any Suggestions?

/Kaf
www.afiouni.com|||>> Actually I am checking for an ultimate solution to the SQL injection
issues. <<

Never write dynamic SQL; learn how to program correctly instead. This
is part of any basic Software Engineering course.

--CELKO--
===========================
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!|||Khaled Afiouni (post@.afiouni.com) writes:
> I am trying to find an ultimate solution to the SQL injection issues.
> In addition to verifying, validating and checking on the data entry
> fields, I would like to prevent compound statements from running and
> only allowing the first SQL statement to run.

To do that you would have to add some middleware and have all your
clients talk to that middleware, and this middleware would pass the
code to SQL Server after validation and then pass the data back.

Not for the faint of heart. And it would be a reduction in usability,
since there sometimes be very good reason for an application to submit
two commands one go.

And you would not even be safe. You could intercept dynamic SQL created
client side, but not dynamic SQL created in stored procedures.

First step, is to let the users run the application with as few permissions
as possible. Ideally, all access should be through stored procedures, and
there should not be any dynamic SQL in the SPs as well. The users only
needs EXEC permission to the procedures. Now, this may hamper usability,
since some functions are easier to implement with dynamic SQL, not the
least if you want performance. (Typically this is search functions where
the users can search on a number of criterias.) But if you restrict
access to SELECT on the table, an intruder cannot wreck your database.

Next step is to write the SQL code properly. If you are constructing
SQL code client-side, use prepared statements with placeholds for
the parameters. Never build the entire string with values and all.
You can also call sp_executesql directly through RPC methods, *not*
as EXEC statements!

If you use dynamic SQL in stored procedures, use sp_executesql to run
your dynamic SQL, not EXEC().

For dynamic SQL on the client side, I have some articles on my web site:
http://www.sommarskog.se/dynamic_sql.html
http://www.sommarskog.se/dyn-search.html

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||After following this thread for a few go-rounds, perhaps it is worth asking,
what is it that you are trying to achieve by stopping such compound
commands?
In particular, why is there SQL outside your control being posted to your
server?
No criticism of your system, just feels like your respondents could use a
"bigger picture".

"Khaled Afiouni" <post@.afiouni.com> wrote in message
news:a5c90178.0407070152.17be0506@.posting.google.c om...
> Hello,
> How can I stop/prevent SQL server from running compound SQL
> statements. I do not want the server to run multiple
> update/delete/insert/select statements as a batch. Is there an option?
> /Kaf
> www.afiouni.com|||Erland Sommarskog <esquel@.sommarskog.se> wrote in message news:<Xns951FEBF2D734Yazorman@.127.0.0.1>...
> Khaled Afiouni (post@.afiouni.com) writes:
> > I am trying to find an ultimate solution to the SQL injection issues.
> > In addition to verifying, validating and checking on the data entry
> > fields, I would like to prevent compound statements from running and
> > only allowing the first SQL statement to run.
> To do that you would have to add some middleware and have all your
> clients talk to that middleware, and this middleware would pass the
> code to SQL Server after validation and then pass the data back.
> Not for the faint of heart. And it would be a reduction in usability,
> since there sometimes be very good reason for an application to submit
> two commands one go.
> And you would not even be safe. You could intercept dynamic SQL created
> client side, but not dynamic SQL created in stored procedures.
> First step, is to let the users run the application with as few permissions
> as possible. Ideally, all access should be through stored procedures, and
> there should not be any dynamic SQL in the SPs as well. The users only
> needs EXEC permission to the procedures. Now, this may hamper usability,
> since some functions are easier to implement with dynamic SQL, not the
> least if you want performance. (Typically this is search functions where
> the users can search on a number of criterias.) But if you restrict
> access to SELECT on the table, an intruder cannot wreck your database.
> Next step is to write the SQL code properly. If you are constructing
> SQL code client-side, use prepared statements with placeholds for
> the parameters. Never build the entire string with values and all.
> You can also call sp_executesql directly through RPC methods, *not*
> as EXEC statements!
> If you use dynamic SQL in stored procedures, use sp_executesql to run
> your dynamic SQL, not EXEC().
> For dynamic SQL on the client side, I have some articles on my web site:
> http://www.sommarskog.se/dynamic_sql.html
> http://www.sommarskog.se/dyn-search.html

Thank you for taking the time to write that helpfull reply. I appreciate it.

/Kaf
www.afiouni.com|||"Mischa Sandberg" <mischa_sandberg@.telus.net> wrote in message news:<km1Hc.11732$eO.2611@.edtnps89>...
> After following this thread for a few go-rounds, perhaps it is worth asking,
> what is it that you are trying to achieve by stopping such compound
> commands?
> In particular, why is there SQL outside your control being posted to your
> server?
> No criticism of your system, just feels like your respondents could use a
> "bigger picture".
> "Khaled Afiouni" <post@.afiouni.com> wrote in message
> news:a5c90178.0407070152.17be0506@.posting.google.c om...
> > Hello,
> > How can I stop/prevent SQL server from running compound SQL
> > statements. I do not want the server to run multiple
> > update/delete/insert/select statements as a batch. Is there an option?
> > /Kaf
> > www.afiouni.com

You are absolutely right. Allow me to share those documents with
everybody.

cnscenter.future.co.kr/resource/rsc-center/vendor-wp/Spidynamics/WhitepaperSQLInjection2.pdf

http://jo.morales0002.eresmas.net/o...QLInjection.pdf

This issue can get scary especially that I did see it in action :-)

/Kaf
www.afiouni.com|||Joe Celko <jcelko212@.earthlink.net> wrote in message news:<40ec4e5d$0$16505$c397aba@.news.newsgroups.ws>...
> >> Actually I am checking for an ultimate solution to the SQL injection
> issues. <<
> Never write dynamic SQL; learn how to program correctly instead. This
> is part of any basic Software Engineering course.
> --CELKO--
> ===========================
> Please post DDL, so that people do not have to guess what the keys,
> constraints, Declarative Referential Integrity, datatypes, etc. in your
> schema are.
> *** Sent via Devdex http://www.devdex.com ***
> Don't just participate in USENET...get rewarded for it!

O:-)

/Kaf
www.afiouni.com|||I used to work for Simba.com (now owned by Orbital.com). Simba produced the
SQL engine/driver kit behind about half the ODBC drivers in the world.

We had a tiny ODBC proxy driver that did more or less what you were asking.
It received the SQL commands, applied the engine's parser to them, did some
rulechecking/rewriting of the parse tree based on the customer's
requirements, and either responded with an error, or forwarded the parse
tree (collapsed back to a command string) to the REAL ODBC connection.

You may want to check with Orbital on that.

"Khaled Afiouni" <post@.afiouni.com> wrote in message ...
cnscenter.future.co.kr/resource/rsc-center/vendor-wp/Spidynamics/WhitepaperS
QLInjection2.pdf
> http://jo.morales0002.eresmas.net/o...QLInjection.pdf
> This issue can get scary especially that I did see it in action :-)
> /Kaf
> www.afiouni.com

Sunday, March 11, 2012

Complicated join question.

Hi there.

I'm running Microsoft Business Solutions GP 8 backed by SQL Server 2000. I need to write a little C#/.NET 2.0 app to go "behind the scenes" to the SQL server in order to fetch and alter some data.

Unfortunately, the tables that GP 8 has created seem strange to me; I've encountered an issue with a SELECT clause featuring two INNER JOINs.

I need to select columns from three different tables. Unfortunately, the key structure of these tables is strange at best. You may view the structure of the three tables from the following URL.

http://pastebin.com/732226

My SQL query is as follows.

SELECT IV30400.DOCNUMBR, IV30300.DOCDATE, IV30200.GLPOSTDT, IV30400.SERLTNUM, IV30400.ITEMNMBR, IV30400.SERLTQTY

FROM IV30400

INNER JOIN IV30300 ON IV30300.DOCNUMBR = IV30400.DOCNUMBR

INNER JOIN IV30200 ON IV30200.DOCNUMBR = IV30300.DOCNUMBR

The key I am joining on is DOCNUMBR. The end result is that I get multiple copies of the same joint row in my result set. I only want one copy of each joint row.

Curiously, the DOCNUMBR key column does not contain unique values. In several rows (in each of the tables, mind you), the value in the DOCNUMBR column is identical. I don't know of this is the cause of my problem.

If anyone can help me sort out this thorny problem I would greatly appreciate it.

Thank you,

--JT

Curiously, the DOCNUMBR key column does not contain unique values. In several rows (in each of the tables, mind you), the value in the DOCNUMBR column is identical. I don't know of this is the cause of my problem.

I have seen programs like this and it is horrifying at best to work with the data (and this is their goal by making the table names so darn user friendly. I couldn't open your pictures, so you might just want to script them out.

Are there any queries in the program that give you somehting close to what you want? I used canned reports from the program I was working with to figure out the really hairy schema using Profiler (the greatest tool in the SQL Server toolbox.

Also, look to see if there is any table with docnumbr unique, of see if there is some other uniqueness criteria you can use.

|||

GROUP BY?

SELECT IV30400.DOCNUMBR, IV30300.DOCDATE, IV30200.GLPOSTDT, IV30400.SERLTNUM, IV30400.ITEMNMBR, IV30400.SERLTQTY

FROM IV30400

INNER JOIN IV30300 ON IV30300.DOCNUMBR = IV30400.DOCNUMBR

INNER JOIN IV30200 ON IV30200.DOCNUMBR = IV30300.DOCNUMBR

Group By IV30400.DOCNUMBR, IV30300.DOCDATE, IV30200.GLPOSTDT, IV30400.SERLTNUM, IV30400.ITEMNMBR, IV30400.SERLTQTY

Does that help at all?

Adamus

|||

Hi Adamus,

That indeed removed the duplicate result rows. I'm not sure WHY it works: I'm guessing that it's because the GROUP BY clause doesn't contain any sorting criteria, and thus it drops the duplicate rows altogether. Thank you for your suggestion!

Now I wonder why the tables are organized in this fashion. It almost seems counter-productive. Oh well.

Thanks again,

--JT

|||

Sounds like sloppy table design. Must've been crunched for time.

Adamus

Wednesday, March 7, 2012

Complex security setting on SQL 7.0

Hi,
I am running a financial database on SQL 7.0. For several reasons I cannot
upgrade to another version shortly. My problem is that I need to create
database users that have limited access to a number of tables.
Example:
tableX:
code, value, type
a, 100, x
a, 200, y
b, 300, x
b, 400, x
tableY:
code, secgroup
a, confidential
b, nonconfidential
relation between tables:
tablex.code=tableY.code
I want to setup a database user that has read-rights on tableY and limited
read-rights on tableX.
On tableX the user may only see the records for which the group in tableY
the secgroup is "nonconfidential" or for which the type in tableX is set to
"y".
Possible solution:
The only possibility I came up with so far, is to create a view on tableX
like:
create view viewX as
select tableX.code, tableX.value, tableX.type
from tableX inner join tableY on (tableX.code=tableY.code)
where tableX.type='y' or tableY.secgroup='nonconfidential'
If I now create a database user with read-rights to the view only, I think
it will work. My questions are:
1. Is this the best solution for achieving my goal?
2. What will this mean to the performance of my queries?
Any insight will be helpful.
Michel LaanFrom your description, a view appears to be the best (and possibly only)
solution. As far as performance, you will have to benchmark this yourself
because there are too many factors involved to determine this.
Rand
This posting is provided "as is" with no warranties and confers no rights.

complex security on SQL 7

Hi,

I am running a financial database on SQL 7.0. For several reasons I cannot
upgrade to another version shortly. My problem is that I need to create
database users that have limited access to a number of tables.

Example:
tableX:
code, value, type
a, 100, x
a, 200, y
b, 300, x
b, 400, x

tableY:
code, secgroup
a, confidential
b, nonconfidential

relation between tables:
tablex.code=tableY.code

I want to setup a database user that has read-rights on tableY and limited
read-rights on tableX.
On tableX the user may only see the records for which the group in tableY
the secgroup is "nonconfidential" or for which the type in tableX is set to
"y".

Possible solution:
The only possibility I came up with so far, is to create a view on tableX
like:
create view viewX as
select tableX.code, tableX.value, tableX.type
from tableX inner join tableY on (tableX.code=tableY.code)
where tableX.type='y' or tableY.secgroup='nonconfidential'

If I now create a database user with read-rights to the view only, I think
it will work. My questions are:
1. Is this the best solution for achieving my goal?
2. What will this mean to the performance of my queries?

Any insight will be helpful.
Michel Laan"Michel Laan" <mlaan@.compuserve.com> wrote in message news:<bttvfk$85r$1@.ngspool-d02.news.aol.com>...
> Hi,
> I am running a financial database on SQL 7.0. For several reasons I cannot
> upgrade to another version shortly. My problem is that I need to create
> database users that have limited access to a number of tables.
> Example:
> tableX:
> code, value, type
> a, 100, x
> a, 200, y
> b, 300, x
> b, 400, x
> tableY:
> code, secgroup
> a, confidential
> b, nonconfidential
> relation between tables:
> tablex.code=tableY.code
> I want to setup a database user that has read-rights on tableY and limited
> read-rights on tableX.
> On tableX the user may only see the records for which the group in tableY
> the secgroup is "nonconfidential" or for which the type in tableX is set to
> "y".
> Possible solution:
> The only possibility I came up with so far, is to create a view on tableX
> like:
> create view viewX as
> select tableX.code, tableX.value, tableX.type
> from tableX inner join tableY on (tableX.code=tableY.code)
> where tableX.type='y' or tableY.secgroup='nonconfidential'
> If I now create a database user with read-rights to the view only, I think
> it will work. My questions are:
> 1. Is this the best solution for achieving my goal?
> 2. What will this mean to the performance of my queries?
> Any insight will be helpful.
> Michel Laan

This solution looks perfectly reasonable to me, and is a common way to
use views. As you said, you can GRANT SELECT on the view plus tableY
only, and that should give you the access you want. An alternative (or
indeed additional) possibility is to allow access to the tables only
through a stored procedure, which may be useful if you need to bring
in more complex permissions logic.

As for performance, that is a separate question, but a normal view is
transparent to the query optimizer (it essentially replaces the view
name with its definition when you submit a query), so using a view
doesn't raise any special performance issues as such.

Simon

Sunday, February 19, 2012

COMPLETE NEWBIE - sorry :-(

I have mysql running on a windows2003 webserver - it runs a
messageboard and oscommerce. Potential new client wants to replicate
information from the website to her server - is this possible with
mysql or do I need to install sql (proper) ... sorry if I sound like I
don't know fully what I am doing - i dont!!
Any advice or pointers given would be greatly appreciated.
thanks
Jeff
Jeff/Andrew,
this is a MS SQL Server Replication newsgroup - surely there are dedicated
MySQL discussion boards?
Rgds,
Paul Ibison
|||On Sun, 24 Apr 2005 19:07:16 +0100, "Paul Ibison"
<Paul.Ibison@.Pygmalion.Com> wrote:

>Jeff/Andrew,
>this is a MS SQL Server Replication newsgroup - surely there are dedicated
>MySQL discussion boards?
>Rgds,
>Paul Ibison
>
I can't find one and I suspect I will end up installing SQL for
replication - can someone please advise?
|||Have a look at http://forums.mysql.com/list.php?26
From the point of view of SQL Server Replication, you can certainly achieve
your aim. For the new client you need to consider latency (time between
change on the publisher and corresponding change arriving at the subscriber)
, autonomy (can they be offline) and if the subscriber is read-only or
read-write. Answering these will lead to the correct type of replication.
Having SQL Server on the webserver would mean this is the publisher.
Heterogenous subscribers are supported to differing extents, but
connectivity to MYSQL is possible and is illustrated in Hilary's book below.
HTH,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||while I'd love you to buy my book
1) its covered on the free downloadable sample chapter
http://www.nwsu.com/lowres_replication_ch02.pdf
2) Replication to MySQL doesn't work - or works until the distribution agent
stops and then you have to resync to get it working again due to a SQL
Server bug.
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:%23CtbxJQSFHA.2748@.TK2MSFTNGP09.phx.gbl...
> Have a look at http://forums.mysql.com/list.php?26
> From the point of view of SQL Server Replication, you can certainly
> achieve your aim. For the new client you need to consider latency (time
> between change on the publisher and corresponding change arriving at the
> subscriber) , autonomy (can they be offline) and if the subscriber is
> read-only or read-write. Answering these will lead to the correct type of
> replication. Having SQL Server on the webserver would mean this is the
> publisher. Heterogenous subscribers are supported to differing extents,
> but connectivity to MYSQL is possible and is illustrated in Hilary's book
> below.
> HTH,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
|||Interesting - thanks for the clarification. In that case your (Andrew's)
client might want to consider MSDE as a replacement for a MySQL subscriber.
Rgds,
Paul Ibison

Complete Command of given PID

Hi,
we sometimes have statements which seem to block the whole server.
now i use this to get information of running processes:
SELECT
spid,
kpid,
status,
hostname
, USER_NAME(uid)
, program_name
, DB_NAME(dbid)
, memusage,*
FROM
master.dbo.sysprocesses
WHERE
status = 'runnable'
ORDER BY
status
aSC
the cmd row only shows the single first row of the statement,
so i cant get the information where the statement really comes from.
is there a way to get it all? maybe the whole statment or
sp_ text which is running inside this pid?
thanks,
peppiAs an alternative, have you considered using the SQL Profiler?|||Yes,-)
sometimes bad processes are running on 100% cpu and i cant even start
enterprise manager. only thing i can get running is queryanalyzer, so
i need some handy stuff to get information to kill some tasks and
see where it came from first.
i found fn_get_sql migt be useful,
maybe someone has got a procedure which gets all running tasks and
shows the text in one procedure?
thanks,
mike|||This may help
http://www.sommarskog.se/sqlutil/aba_lockinfo.html|||If you have PID with you,
run =>
DBCC INPUTBUFFER(PID),
to get the query rather than getting it from sysprocess...
If you have to monitor more and need to get the full query use Profiler.
Thanks,
Sree
"markc600@.hotmail.com" wrote:

> As an alternative, have you considered using the SQL Profiler?
>

Friday, February 17, 2012

compensating delete on replication database!

Hi
I have Merge Publication with just one Subscriber running on SQL 2000
which has been Service packed fully.
Looking at the previous posts I did uncheck 'Enforce relationship for
replication' on the Table Relationships hoping that the deletion of
records will not happen.
But for some unknown reason the records in the FK relationship is
deleted, which is causing all sorts of problems. There are no Triggers
on the database, and I could not find a pattern for the deletion it
happens randomly.
E.G. We have a 'Contacts' and 'Addresses' Table, one contact can have
more than 1 address. But for some reason the addresses are being deleted
for the contact, i am not sure where it is happening whether in
Subscriber or Publisher, but we loose the record.
Does any one has a good solution for this?
Thanks in advance.
Regards
Laks
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
Do you have any user triggers at all?
Perhaps you are experiencing the compensating commands situation :
http://support.microsoft.com/default...Product=sql2k?
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)!
|||Thanks Paul for the link. But I do not have any user triggers at all?
Since the 'Enforce relationship for replication' is unchecked, I am a
bit puzzled about how this is happening.
Can I apply the hotfix (the link you have sent) to the production
server? Is it safe?
Thanks once again.
Regards
Laks
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
|||Hi Paul
The Hotfix is available only in SP4 Beta and not sure when it is going
to be released. In the meantime the database is loosing the records all
the way through. Can you suggest any intermediate solutions? somethings
I need to check etc..
Thanks
Laks
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
|||The two suggestions weren't related - user triggers was just one other
posibility.
If it is a compensation issue, you should be able to reproduce. An address
added successfully at one site will be deleted if it cannot be applied at
the other due to a PK/FK error, constraint error etc. So, you need to check
that the schemas are identical wrt these tables (SQLCompare?). If you can
find an address that repeatedly gets removed then tracking/removing the
constraint should be simple.
HTH,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)!
|||Hi Paul
Thanks for the reply. There is not pattern these records are deleted and
I am not able to re-create it as well.
The Addresses Table has 2 FK relationship one to the AddressType Table
and one to the Contact Table were the records are all present. It is
only the Address records that gets deleted.
Any other areas to look into, please...
Thanks
Laks
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
|||Hi Paul
I am really sorry, there is a Trigger created by another developer on
the Addresses Table, which maintaines the Ref. Intergerity. Could this
be the cause for this 'compensating deletion', if so how to overcome
this, do we need to remove the triggers?
Regards
Laks
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!

Tuesday, February 14, 2012

Compatible versions of compiler

Hi,
We are running Digital unix 4.0 and would like to upgrade to v5.1b. We need to find where C++ compiler v6.1-029 and C Compiler c5.6-071 are compatible with Digital unix 5.1b. If not, then what version of these compiler should I be usingWrong forum mate :-)

Compatibility level, SQL 2005

In SQL Server 2005 it is possible to set a compatibility level.
Prior to this server we were running SQL 2000. Wil still have one
linked server running SQL 2000.
What I'm about: what does this comp. level actually do? When
is it an advantage - and when not?
Regards /SnedkerMorten Snedker (morten_spammenot_ATdbconsult.dk) writes:
> In SQL Server 2005 it is possible to set a compatibility level.
> Prior to this server we were running SQL 2000. Wil still have one
> linked server running SQL 2000.
> What I'm about : what does this comp. level actually do? When
> is it an advantage - and when not?
Use it only if you have legacy code that does not compile in SQL 2005, and
you don't find it worth the effort to fix the code. (Or you can't, because
it's a 3rd party app.)
I don't remember on the top of my head if there are any run-time differences
between compatibility levels 80 and 90. (There are between 60/65 and the
others.)
Note that if you go with compatibility level 80, there may be new features
that will not be available to you.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Check Books Online for SQL Server 2005, sp_dbcmptlevel. You'll find an elabo
rate explanation about
what these settings do.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Morten Snedker" <morten_spammenot_ATdbconsult.dk> wrote in message
news:qdji82562gpo3ojtlk8oinohdktejkup5r@.
4ax.com...
> In SQL Server 2005 it is possible to set a compatibility level.
> Prior to this server we were running SQL 2000. Wil still have one
> linked server running SQL 2000.
> What I'm about : what does this comp. level actually do? When
> is it an advantage - and when not?
>
> Regards /Snedker|||Erland wrote on Fri, 9 Jun 2006 11:13:55 +0000 (UTC):

> Morten Snedker (morten_spammenot_ATdbconsult.dk) writes:
> Use it only if you have legacy code that does not compile in SQL 2005, and
> you don't find it worth the effort to fix the code. (Or you can't, because
> it's a 3rd party app.)
> I don't remember on the top of my head if there are any run-time
> differences between compatibility levels 80 and 90. (There are between
> 60/65 and the others.)
> Note that if you go with compatibility level 80, there may be new features
> that will not be available to you.
>
And also features like backups - at anything except level 90 you can't back
up your database!
Dan|||Daniel Crichton (msnews@.worldofspack.com) writes:
> And also features like backups - at anything except level 90 you can't
> back up your database!
What? Where did you get that from?
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||> And also features like backups - at anything except level 90 you can't bac
k up your database!
That would have been a disaster. Backup work find, I just tried below on my
2005 sp2 instance:
exec sp_dbcmptlevel 'pubs', 80
BACKUP DATABASE pubs TO DISK = 'C:\pubs.bak'
Perhaps there is a problem win some of the tools if db compat level is lower
? Like SSMS or Maint
plans?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Daniel Crichton" <msnews@.worldofspack.com> wrote in message
news:e2nNjE9iGHA.1640@.TK2MSFTNGP02.phx.gbl...
> Erland wrote on Fri, 9 Jun 2006 11:13:55 +0000 (UTC):
>
>
> And also features like backups - at anything except level 90 you can't bac
k up your database!
> Dan
>|||Tibor wrote on Fri, 9 Jun 2006 17:01:59 +0200:

> That would have been a disaster. Backup work find, I just tried below on
> my 2005 sp2 instance:
> exec sp_dbcmptlevel 'pubs', 80
> BACKUP DATABASE pubs TO DISK = 'C:\pubs.bak'
> Perhaps there is a problem win some of the tools if db compat level is
> lower? Like SSMS or Maint plans?
Ah, yeah, that was it - SSMS won't allow a maintenance plan for a compat
level 80 db, it doesn't show them in the list of available databases to be
backed up.
Dan|||Erland wrote on Fri, 9 Jun 2006 14:59:51 +0000 (UTC):

> Daniel Crichton (msnews@.worldofspack.com) writes:
> What? Where did you get that from?
>
I restored a 2000 db to 2005, it was compatibility 80, I couldn't run
BACKUP. I switched it to 90, BACKUP runs fine.
Dan|||Daniel wrote to Erland Sommarskog on Mon, 12 Jun 2006 08:36:36 +0100:

> Erland wrote on Fri, 9 Jun 2006 14:59:51 +0000 (UTC):
>
> I restored a 2000 db to 2005, it was compatibility 80, I couldn't run
> BACKUP. I switched it to 90, BACKUP runs fine.
As I replied to Tibor, it was the maintenance wiz in SMSS that won't see the
databases at compatibility 80, not BACKUP itself. Sorry, my memory was a
little hazy on this one.
Dan

Compatibility level

I have a sql 2000 db now running in sql server 2005.
The compatibility level is set to sql 2000.
If everything works should i leave it as is? or
Will changing it to sql server 2005 give me better performance?
HowardI don't think it is much to do with performance. Sooner or later you
do need to upgrade the database to the next level.
The compatibility level allows administrators to upgrade the system
while developers/3rd party company can still work on in-house
applications (make sure it is MSSQL 2005 compatible). It provides a
option for administrator (rather than wait for the developers to finish
the job, you can upgrade the system first and adjusting the
compatibility level later on when it is ready).
For examples, new reserved words introduced. Once you confirm the new
application has got rid of the reserved words, you can then safely
change the compatibility level to the latest which won't work in the
pervious version.
Mel|||Best option is to test your application on test server on SQL Server
2005 with compatibility level 90 and when it works satisfactory deploy
it on live.
Regards
Amish Shah

Sunday, February 12, 2012

Compatibility level

I have a sql 2000 db now running in sql server 2005.
The compatibility level is set to sql 2000.
If everything works should i leave it as is? or
Will changing it to sql server 2005 give me better performance?
HowardI don't think it is much to do with performance. Sooner or later you
do need to upgrade the database to the next level.
The compatibility level allows administrators to upgrade the system
while developers/3rd party company can still work on in-house
applications (make sure it is MSSQL 2005 compatible). It provides a
option for administrator (rather than wait for the developers to finish
the job, you can upgrade the system first and adjusting the
compatibility level later on when it is ready).
For examples, new reserved words introduced. Once you confirm the new
application has got rid of the reserved words, you can then safely
change the compatibility level to the latest which won't work in the
pervious version.
Mel|||Best option is to test your application on test server on SQL Server
2005 with compatibility level 90 and when it works satisfactory deploy
it on live.
Regards
Amish Shah

compatability question

We have a Win 2000 Server running MS SQL Server 7.0.
The application using the SQL database is not compatible with SQL 2000.
We want to upgrade the OS on the server to Win 2003.
Is Win 2003 compatible with SQL 7.0?
Thanks
ccoatesI am pretty sure SQL 7.0 is not supported on Win2003. SQL 2000 is pretty
much backward compatible so you might want to just fix what the issue is
with 2000.
Andrew J. Kelly
SQL Server MVP
"Chris Coates" <ccoates@.gfs.com> wrote in message
news:OAd4jEc6DHA.3860@.tk2msftngp13.phx.gbl...
quote:

> We have a Win 2000 Server running MS SQL Server 7.0.
> The application using the SQL database is not compatible with SQL 2000.
> We want to upgrade the OS on the server to Win 2003.
> Is Win 2003 compatible with SQL 7.0?
> Thanks
> ccoates
>

compatability question

We have a Win 2000 Server running MS SQL Server 7.0.
The application using the SQL database is not compatible with SQL 2000.
We want to upgrade the OS on the server to Win 2003.
Is Win 2003 compatible with SQL 7.0?
Thanks
ccoatesI am pretty sure SQL 7.0 is not supported on Win2003. SQL 2000 is pretty
much backward compatible so you might want to just fix what the issue is
with 2000.
--
Andrew J. Kelly
SQL Server MVP
"Chris Coates" <ccoates@.gfs.com> wrote in message
news:OAd4jEc6DHA.3860@.tk2msftngp13.phx.gbl...
> We have a Win 2000 Server running MS SQL Server 7.0.
> The application using the SQL database is not compatible with SQL 2000.
> We want to upgrade the OS on the server to Win 2003.
> Is Win 2003 compatible with SQL 7.0?
> Thanks
> ccoates
>

Friday, February 10, 2012

Comparision test SQL 7.0 and 2000

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 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 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 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 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 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
>
>