Showing posts with label schema. Show all posts
Showing posts with label schema. Show all posts

Thursday, March 22, 2012

Computed column formulae...2000 vs 2005

My head hurts!

I have a wicked database upgrade mechanism that works broadly like this:

    Master database schema is scanned into an object model then saved to an XML file.

    Sometime later...XML file is loaded back into object model and target database schema is scanned into another instance of this object model

    CompareSchemas routine takes both object models as input, compares them, and outputs a collection of Actions needed to bring the target in line with the master i.e. it works out all the DDL statements necessary to synchronize the database structure.

My problem is that I need to have this working seamlessly between 2000 and 2005 - our master development is still in SQL Server 2000 and will be until all our customers have moved up to 2005 (who knows how long that will take), but we have to allow new customers to run with 2005.

At the moment my upgrade mechanism always states that computed columns have changed. It seems that 2005 formats the formulae for computed columns differently to how 2000 did:

SQL 2000 version:

([bygroup] + 2 * [bysubgroup] + 4 * [byexchangecode] + 8 * [byitem])

SQL 2005 version:

((([bygroup]+(2)*[bysubgroup])+(4)*[byexchangecode])+(8)*[byitem])

Short of writing an expression parser to identify the fact that these two formulae are identical (which I REALLY don't have time for!), is there any way to get 2005 to format the formula in the same way as 2000?

Anyone?|||Any one at all? |||

I don't know of anyway to force sql2k5 to give you the sql2k format. However, wouldn't it be as simple as a replace (i.e. replace('sql2k5 format','sql2k format)).

Wednesday, March 7, 2012

Complex Schema problem

Ok, the mapping schema is as under:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ht="http://www.w3.org/1999/xhtml" xmlns:cus="http://localhost/"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema"
targetNamespace="http://localhost/" elementFormDefault="qualified"
attributeFormDefault="unqualified" >
<xs:element name="template">
<xs:complexType>
<xs:sequence>
<xs:element name="PatientDetails1" type="cus:FullNameBlock"
sql:relation="PatientDetails"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="FullNameBlock">
<xs:sequence>
<xs:element name="Name" type="cus:NameBlock" sql:relation="PatientName">
<xs:annotation>
<xs:appinfo>
<sql:relationship parent="PatientDetails" parent-key="PDName"
child="PatientName" child-key="ID" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="NameBlock">
<xs:sequence>
<xs:element name="FirstName" type="xs:string" sql:field="PDNFirstName" />
<xs:element name="LastName" type="xs:string" sql:field="PDNLastName" />
</xs:sequence>
<xs:attribute name="id" type="xs:ID"/>
</xs:complexType>
</xs:schema>
I am trying to xpath query the above schema using the following code:
try{
SqlXmlCommand cmd;
FileStream f;
string conString = "Provider=SQLOLEDB;Data
Source='(local)';database=TestRep; Integrated Security=SSPI";
cmd = new SqlXmlCommand(conString);
cmd.Namespaces = "xmlns:x='http://localhost/'";
cmd.CommandType = SqlXmlCommandType.XPath;
cmd.CommandText = "x:PatientDetails1";
cmd.SchemaPath = " F:\\Testing\\XML\\CustomSchema\\CustomSc
hema4.xsd";
f = new FileStream("F:\\Testing\\XML\\CustomList3.xml", FileMode.Create);
cmd.ExecuteToStream(f);
f.Close() ;
}
catch(Exception ex)
{
string temp = ex.Message;
MessageBox.Show(temp);
}
}
when I run the above mentioned code it throws the following exception:
SqlXmlException
Message="Schema: relationship expected on 'PatientDetails1'."
"Rainabba" wrote:

> Sounds like you want to look at using is-mapped="false", but you didn't gi
ve
> enough detail for me to be sure what you're doing. You can only have one
> "root" node so mapping it at all should typically throw an error unless
> you're using limit-field/limit-value to ensure you have only one row
> returning to map. If that doesn't help, be sure to reply with the exceptio
n
> and a copy of the schema throwing it.
> rainabba
> "Ahsan" <Ahsan@.discussions.microsoft.com> wrote in message
> news:9640E9E3-78A8-4CFB-8388-5377CC81A283@.microsoft.com...
> database
> schema
>Could you please try again with putting sql:is-constant='1' on the root
element (the element named as 'template' in your below schema) you don't
want to map?
Bertan ARI
This posting is provided "AS IS" with no warranties, and confers no rights.
"Ahsan" <Ahsan@.discussions.microsoft.com> wrote in message
news:A2C7C59D-5C67-4B9D-AF8B-6BF11FBA0C3B@.microsoft.com...
> Ok, the mapping schema is as under:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:ht="http://www.w3.org/1999/xhtml" xmlns:cus="http://localhost/"
> xmlns:sql="urn:schemas-microsoft-com:mapping-schema"
> targetNamespace="http://localhost/" elementFormDefault="qualified"
> attributeFormDefault="unqualified" >
> <xs:element name="template">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="PatientDetails1" type="cus:FullNameBlock"
> sql:relation="PatientDetails"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:complexType name="FullNameBlock">
> <xs:sequence>
> <xs:element name="Name" type="cus:NameBlock" sql:relation="PatientName">
> <xs:annotation>
> <xs:appinfo>
> <sql:relationship parent="PatientDetails" parent-key="PDName"
> child="PatientName" child-key="ID" />
> </xs:appinfo>
> </xs:annotation>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="NameBlock">
> <xs:sequence>
> <xs:element name="FirstName" type="xs:string" sql:field="PDNFirstName" />
> <xs:element name="LastName" type="xs:string" sql:field="PDNLastName" />
> </xs:sequence>
> <xs:attribute name="id" type="xs:ID"/>
> </xs:complexType>
> </xs:schema>
> I am trying to xpath query the above schema using the following code:
>
> try{
> SqlXmlCommand cmd;
> FileStream f;
> string conString = "Provider=SQLOLEDB;Data
> Source='(local)';database=TestRep; Integrated Security=SSPI";
> cmd = new SqlXmlCommand(conString);
> cmd.Namespaces = "xmlns:x='http://localhost/'";
> cmd.CommandType = SqlXmlCommandType.XPath;
> cmd.CommandText = "x:PatientDetails1";
> cmd.SchemaPath = " F:\\Testing\\XML\\CustomSchema\\CustomSc
hema4.xsd";
> f = new FileStream("F:\\Testing\\XML\\CustomList3.xml", FileMode.Create);
> cmd.ExecuteToStream(f);
> f.Close() ;
> }
> catch(Exception ex)
> {
> string temp = ex.Message;
> MessageBox.Show(temp);
> }
> }
> when I run the above mentioned code it throws the following exception:
> SqlXmlException
> Message="Schema: relationship expected on 'PatientDetails1'."
> "Rainabba" wrote:
>
>
>

Complex Schema problem

I am trying to map a xml schema to a database. If I map the table with the
root node it works fine. But if I try to map the subelement with the database
table i.e the root node is not mapped to any database table than it throws
exception.
Can anyone elaborate.
Also, If someone has a good tutorial or example regarding the complex schema
mapping please refer it to me.
Sounds like you want to look at using is-mapped="false", but you didn't give
enough detail for me to be sure what you're doing. You can only have one
"root" node so mapping it at all should typically throw an error unless
you're using limit-field/limit-value to ensure you have only one row
returning to map. If that doesn't help, be sure to reply with the exception
and a copy of the schema throwing it.
rainabba
"Ahsan" <Ahsan@.discussions.microsoft.com> wrote in message
news:9640E9E3-78A8-4CFB-8388-5377CC81A283@.microsoft.com...
> I am trying to map a xml schema to a database. If I map the table with the
> root node it works fine. But if I try to map the subelement with the
database
> table i.e the root node is not mapped to any database table than it throws
> exception.
> Can anyone elaborate.
> Also, If someone has a good tutorial or example regarding the complex
schema
> mapping please refer it to me.
|||Ok, the mapping schema is as under:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ht="http://www.w3.org/1999/xhtml" xmlns:cus="http://localhost/"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema"
targetNamespace="http://localhost/" elementFormDefault="qualified"
attributeFormDefault="unqualified" >
<xs:element name="template">
<xs:complexType>
<xs:sequence>
<xs:element name="PatientDetails1" type="cus:FullNameBlock"
sql:relation="PatientDetails"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="FullNameBlock">
<xs:sequence>
<xs:element name="Name" type="cus:NameBlock" sql:relation="PatientName">
<xs:annotation>
<xs:appinfo>
<sql:relationship parent="PatientDetails" parent-key="PDName"
child="PatientName" child-key="ID" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="NameBlock">
<xs:sequence>
<xs:element name="FirstName" type="xs:string" sql:field="PDNFirstName" />
<xs:element name="LastName" type="xs:string" sql:field="PDNLastName" />
</xs:sequence>
<xs:attribute name="id" type="xs:ID"/>
</xs:complexType>
</xs:schema>
I am trying to xpath query the above schema using the following code:
try{
SqlXmlCommand cmd;
FileStream f;
string conString = "Provider=SQLOLEDB;Data
Source='(local)';database=TestRep; Integrated Security=SSPI";
cmd = new SqlXmlCommand(conString);
cmd.Namespaces = "xmlns:x='http://localhost/'";
cmd.CommandType = SqlXmlCommandType.XPath;
cmd.CommandText = "x:PatientDetails1";
cmd.SchemaPath = "F:\\Testing\\XML\\CustomSchema\\CustomSchema4.xsd ";
f = new FileStream("F:\\Testing\\XML\\CustomList3.xml", FileMode.Create);
cmd.ExecuteToStream(f);
f.Close() ;
}
catch(Exception ex)
{
string temp = ex.Message;
MessageBox.Show(temp);
}
}
when I run the above mentioned code it throws the following exception:
SqlXmlException
Message="Schema: relationship expected on 'PatientDetails1'."
"Rainabba" wrote:
[vbcol=seagreen]
> Sounds like you want to look at using is-mapped="false", but you didn't give
> enough detail for me to be sure what you're doing. You can only have one
> "root" node so mapping it at all should typically throw an error unless
> you're using limit-field/limit-value to ensure you have only one row
> returning to map. If that doesn't help, be sure to reply with the exception
> and a copy of the schema throwing it.
> rainabba
> "Ahsan" <Ahsan@.discussions.microsoft.com> wrote in message
> news:9640E9E3-78A8-4CFB-8388-5377CC81A283@.microsoft.com...
> database
> schema

>
|||Could you please try again with putting sql:is-constant='1' on the root
element (the element named as 'template' in your below schema) you don't
want to map?
Bertan ARI
This posting is provided "AS IS" with no warranties, and confers no rights.
"Ahsan" <Ahsan@.discussions.microsoft.com> wrote in message
news:A2C7C59D-5C67-4B9D-AF8B-6BF11FBA0C3B@.microsoft.com...[vbcol=seagreen]
> Ok, the mapping schema is as under:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:ht="http://www.w3.org/1999/xhtml" xmlns:cus="http://localhost/"
> xmlns:sql="urn:schemas-microsoft-com:mapping-schema"
> targetNamespace="http://localhost/" elementFormDefault="qualified"
> attributeFormDefault="unqualified" >
> <xs:element name="template">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="PatientDetails1" type="cus:FullNameBlock"
> sql:relation="PatientDetails"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:complexType name="FullNameBlock">
> <xs:sequence>
> <xs:element name="Name" type="cus:NameBlock" sql:relation="PatientName">
> <xs:annotation>
> <xs:appinfo>
> <sql:relationship parent="PatientDetails" parent-key="PDName"
> child="PatientName" child-key="ID" />
> </xs:appinfo>
> </xs:annotation>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="NameBlock">
> <xs:sequence>
> <xs:element name="FirstName" type="xs:string" sql:field="PDNFirstName" />
> <xs:element name="LastName" type="xs:string" sql:field="PDNLastName" />
> </xs:sequence>
> <xs:attribute name="id" type="xs:ID"/>
> </xs:complexType>
> </xs:schema>
> I am trying to xpath query the above schema using the following code:
>
> try{
> SqlXmlCommand cmd;
> FileStream f;
> string conString = "Provider=SQLOLEDB;Data
> Source='(local)';database=TestRep; Integrated Security=SSPI";
> cmd = new SqlXmlCommand(conString);
> cmd.Namespaces = "xmlns:x='http://localhost/'";
> cmd.CommandType = SqlXmlCommandType.XPath;
> cmd.CommandText = "x:PatientDetails1";
> cmd.SchemaPath = "F:\\Testing\\XML\\CustomSchema\\CustomSchema4.xsd ";
> f = new FileStream("F:\\Testing\\XML\\CustomList3.xml", FileMode.Create);
> cmd.ExecuteToStream(f);
> f.Close() ;
> }
> catch(Exception ex)
> {
> string temp = ex.Message;
> MessageBox.Show(temp);
> }
> }
> when I run the above mentioned code it throws the following exception:
> SqlXmlException
> Message="Schema: relationship expected on 'PatientDetails1'."
> "Rainabba" wrote:
>
>

Complex Recursive Query

I have a complex query that I am strugling with in MS SQL Server 2000. I am trying to get all of the websites a user has control of. My schema is as follows:

A user can control many companies, and a company can be controlled by many users. A company can also control other companies (thus a recursive parent relationship). A company can have many websites, but a website can only belong to one company. Thus the design:

USER TABLE
User_ID
User_Name

COMPANY TABLE
Company_ID
Company_Name
Company_ID_Parent (recursive)

USER_COMPANY TABLE
User_ID
Company_ID

WEBSITE TABLE
Website_ID
Company_ID (Foreign Key)

That said, how do I get a list of websites that a user is associated with... meaning, all of the websites that belong to a company that either the user controls directly, or a child-company of a company that either the user controls directly (at any depth).

Getting the websites is actually easy. I need the recursive part figured out.

Thx in Advance.Do you have a fixed relationship depth (companies owning other companies), or is there no limit? A fixed depth makes a static query simple, which will perform better and is a lot easier to keep portable. A SQL function would allow you to solve the problem allowing infinite depth, but at the expense of additional complexity and loss of portability.

-PatP|||Here is a solution I have used effectively in the same type of situation as you describe:

Create table #CompanyList(Company_ID Int)

Insert into #CompanyList
(Company_ID)
Select Company_ID
from USER_COMPANY
where User_ID = [YourUserID]

While @.@.ROWCOUNT > 0
Insert into #CompanyList
(Company_ID)
Select Distinct
COMPANY.Company_ID
From COMPANY
Inner join #CompanyList on COMPANY.Company_ID_Parent = #CompanyList.Company_ID
Where not exists
(select *
from #CompanyList
where #CompanyList.Company_ID = COMPANY.Company_ID)

Select Website_ID
From WEBSITE
Inner join #CompanyList on WEBSITE.Company_ID = #CompanyList.Company_ID

You can convert this algorithm to a function if you like, or replace the temporary table with a table variable.|||Pat, Do you have a fixed relationship depth (companies owning other companies), or is there no limit? A fixed depth makes a static query simple, which will perform better and is a lot easier to keep portable. A SQL function would allow you to solve the problem allowing infinite depth, but at the expense of additional complexity and loss of portability.

Assuming there is a theoretical limit of 3 or 4, what would the query look like?

Blindman, thanks! I'll take a look at that and see if I can get it to work.|||I think the trick on your problem is to recurse all member companies. then from there, list the sites.

here's a sample code to use. I guess you get the idea. Sorry if i didnt verify the syntax. My SQL server is down at a the moment.

-----------

-- *** Returns all member companies
CREATE FUNCTION f_COMPANY_CHILDREN (@.PARENT_ID)
OUTPUT TABLE
AS
SELECT A.COMPANY_ID
FROM COMPANY_TABLE A, F_COMPANY_CHILDREN(A.COMPANY_ID) B
WHERE A.COMPANY_ID_PARENT = @.PARENT_ID
GO

-- *** List companies user has access
SELECT B.USER_ID, A.WEBSITE_ID
FROM WEBSITE A, USER_COMPANY B
WHERE A.COMPANY_ID = B.COMPANY_ID
AND A.COMPANY_ID IN (SELECT COMPANY_ID FROM F_COMPANY_CHILDREN(B.COMPANY_ID))
UNION
SELECT B.USER_ID, A.WEBSITE_ID
FROM WEBSITE A, USER_COMPANY B
WHERE A.COMPANY_ID = B.COMPANY_ID
GO|||Sorry, I missed your reply. I haven't tested this, but I'd suggest something like:SELECT
FROM user_table AS u
INNER JOIN User_company_table AS uc
ON (uc.User_ID = u.User_ID)
INNER JOIN (SELECT DISTINCT z4.Company_ID, z1.Company_ID AS zz
FROM user_company_table AS z1
INNER JOIN user_company_table AS z2
ON (z1.Company_ID IN (z2.Company_ID, z2.Company_ID_Parent))
INNER JOIN user_company_table AS z3
ON (z2.Company_ID IN (z3.Company_ID, z3.Company_ID_Parent))
INNER JOIN user_company_table AS z4
ON (z3.Company_ID IN (z4.Company_ID, z4.Company_ID_Parent)) ) AS c
ON (c.zz = uc.Company_ID)
INNER JOIN website_table AS w
ON (w.Company_ID = c.Company_ID)-PatP|||WhileTSQL allows true recursive code, I have found that they are much less efficient than the "Accumulator table" algorithm I gave earlier, and I believe that recursion is limited to something like 36 levels. It was this ceiling on an EDI database application that led me to switch to the accumulator method.|||WhileTSQL allows true recursive code, I have found that they are much less efficient than the "Accumulator table" algorithm I gave earlier, and I believe that recursion is limited to something like 36 levels. It was this ceiling on an EDI database application that led me to switch to the accumulator method.While your solution is more general (it can handle unlimited depth), mine is definitely more portable, and I'd think that mine would perform better too. Each has its benefits, so at least in my mind there isn't a clear cut decision on which one to use.

-PatP|||For a fixed-level of depth, yours is definitely preferable. Simpler to read, easier to code, and probably more efficient as well. I just prefer using an Accumulator table over a recursive algorithm (such as manilaguy's example) for N-level datasets.|||Thanks for all the info. I think for now I have a theoretical limit, so I will go with Pat's suggestion for testing. But as I build the product, I may need to transition to blindman's way of doing it. For some reason I am just hesitant to create temp tables while many concurrent requests are being handled.

Thanks again.|||Temp tables should not be an issue, but you could also use table variables, which exist only within the scope of the procedure.|||Pat, thanks for the query. I don't see where this links into the Company_Table though. Am I missing something? Perhaps I do not understand the query.

Sorry, I missed your reply. I haven't tested this, but I'd suggest something like:SELECT
FROM user_table AS u
INNER JOIN User_company_table AS uc
ON (uc.User_ID = u.User_ID)
INNER JOIN (SELECT DISTINCT z4.Company_ID, z1.Company_ID AS zz
FROM user_company_table AS z1
INNER JOIN user_company_table AS z2
ON (z1.Company_ID IN (z2.Company_ID, z2.Company_ID_Parent))
INNER JOIN user_company_table AS z3
ON (z2.Company_ID IN (z3.Company_ID, z3.Company_ID_Parent))
INNER JOIN user_company_table AS z4
ON (z3.Company_ID IN (z4.Company_ID, z4.Company_ID_Parent)) ) AS c
ON (c.zz = uc.Company_ID)
INNER JOIN website_table AS w
ON (w.Company_ID = c.Company_ID)-PatP|||I tried running an updated version of Pat's query... but I think I'm missing two things.

1) a join on the company_table (as company_parent_id is not found)
2) a a where clause to filter for a particular user_ID.

Any help is appreciated.|||Actually, I think I figured it out... Here is my final query

SELECT DISTINCT w.WebSite_ID
FROM tbl_User u INNER JOIN
tbl_User_Company uc ON uc.User_ID_lkp = u.User_ID
INNER JOIN (SELECT DISTINCT z4.Company_ID, z1.Company_ID_lkp AS zz
FROM tbl_User_Company z1 INNER JOIN
tbl_Company z2 ON z1.Company_ID_lkp IN (z2.Company_ID, z2.Company_ID_prnt) INNER JOIN
tbl_Company z3 ON z2.Company_ID IN (z3.Company_ID, z3.Company_ID_prnt) INNER JOIN
tbl_Company z4 ON z3.Company_ID IN (z4.Company_ID, z4.Company_ID_prnt)) c
ON c.zz = uc.Company_ID_lkp INNER JOIN
tbl_WebSite w ON w.Company_ID_lkp = c.Company_ID
WHERE (u.User_ID = X)

Friday, February 10, 2012

Comparing two Tables in SQL Server 2000

Hi,
In my SQL Server 2000, I have 2 Tables TableA and TableB.
TableA and TableB have exactly same schema, and they all have 50
datacolumns.
However, the data in TableA and Tables are not the same, they are not copy
to each other.
Now comes my question, since they both have many columns, how do I compare
the data for the two tables?
Thanks for help.
JasonHello,
Take a look into :-
http://www.sql-server-performance.c...pare_review.asp
http://www.sqlteam.com/article/comparing-tables
http://weblogs.sqlteam.com/jeffs/ar...11/10/2737.aspx
THanks
Hari
"Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
news:Oxik5IjrHHA.4108@.TK2MSFTNGP06.phx.gbl...
> Hi,
> In my SQL Server 2000, I have 2 Tables TableA and TableB.
> TableA and TableB have exactly same schema, and they all have 50
> datacolumns.
> However, the data in TableA and Tables are not the same, they are not copy
> to each other.
> Now comes my question, since they both have many columns, how do I compare
> the data for the two tables?
> Thanks for help.
>
> Jason
>|||Jason,
SchemaCrawler can compare a schema against a reference schema.
SchemaCrawler outputs details of your schema (tables, views,
procedures, and more) in a diff-able plain-text format (text, CSV, or
XHTML). SchemaCrawler can also output data for comparison (including
CLOBs and BLOBs) in the same plain-text formats. You can use a
standard diff program to diff the current output with a reference
version of the output.
SchemaCrawler is free, open-source, cross-platform (operating system
and database) tool, written in Java, that is available at
SourceForge:
http://schemacrawler.sourceforge.net/
You will need to provide a JDBC driver for your database. No other
third-party libraries are required. A lot of examples are available
with the download to help you get started.
Sualeh Fatehi.|||On Jun 13, 11:15 pm, "Jason Huang" <JasonHuang8...@.hotmail.com> wrote:
> Hi,
> In mySQLServer2000, I have 2 Tables TableA and TableB.
> TableA and TableB have exactly same schema, and they all have 50
> datacolumns.
> However, the data in TableA and Tables are not the same, they are not copy
> to each other.
> Now comes my question, since they both have many columns, how do Icompare
> the data for the two tables?
> Thanks for help.
> Jason
Jason - check out xSQL Data Compare at http://www.xsqlsoftware.com -
it does exactly what you want and it is free (to be more accurate you
have the full edition free for 2 weeks and after the two week period
is over then the Lite edition is free forever).
Thanks,
JC
xSQL Software
http://www.xsqlsoftware.com

Comparing two Tables in SQL Server 2000

Hi,
In my SQL Server 2000, I have 2 Tables TableA and TableB.
TableA and TableB have exactly same schema, and they all have 50
datacolumns.
However, the data in TableA and Tables are not the same, they are not copy
to each other.
Now comes my question, since they both have many columns, how do I compare
the data for the two tables?
Thanks for help.
Jason
Hello,
Take a look into :-
http://www.sql-server-performance.com/sql_data_compare_review.asp
http://www.sqlteam.com/article/comparing-tables
http://weblogs.sqlteam.com/jeffs/archive/2004/11/10/2737.aspx
THanks
Hari
"Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
news:Oxik5IjrHHA.4108@.TK2MSFTNGP06.phx.gbl...
> Hi,
> In my SQL Server 2000, I have 2 Tables TableA and TableB.
> TableA and TableB have exactly same schema, and they all have 50
> datacolumns.
> However, the data in TableA and Tables are not the same, they are not copy
> to each other.
> Now comes my question, since they both have many columns, how do I compare
> the data for the two tables?
> Thanks for help.
>
> Jason
>
|||Jason,
SchemaCrawler can compare a schema against a reference schema.
SchemaCrawler outputs details of your schema (tables, views,
procedures, and more) in a diff-able plain-text format (text, CSV, or
XHTML). SchemaCrawler can also output data for comparison (including
CLOBs and BLOBs) in the same plain-text formats. You can use a
standard diff program to diff the current output with a reference
version of the output.
SchemaCrawler is free, open-source, cross-platform (operating system
and database) tool, written in Java, that is available at
SourceForge:
http://schemacrawler.sourceforge.net/
You will need to provide a JDBC driver for your database. No other
third-party libraries are required. A lot of examples are available
with the download to help you get started.
Sualeh Fatehi.
|||On Jun 13, 11:15 pm, "Jason Huang" <JasonHuang8...@.hotmail.com> wrote:
> Hi,
> In mySQLServer2000, I have 2 Tables TableA and TableB.
> TableA and TableB have exactly same schema, and they all have 50
> datacolumns.
> However, the data in TableA and Tables are not the same, they are not copy
> to each other.
> Now comes my question, since they both have many columns, how do Icompare
> the data for the two tables?
> Thanks for help.
> Jason
Jason - check out xSQL Data Compare at http://www.xsqlsoftware.com -
it does exactly what you want and it is free (to be more accurate you
have the full edition free for 2 weeks and after the two week period
is over then the Lite edition is free forever).
Thanks,
JC
xSQL Software
http://www.xsqlsoftware.com

Comparing two Tables in SQL Server 2000

Hi,
In my SQL Server 2000, I have 2 Tables TableA and TableB.
TableA and TableB have exactly same schema, and they all have 50
datacolumns.
However, the data in TableA and Tables are not the same, they are not copy
to each other.
Now comes my question, since they both have many columns, how do I compare
the data for the two tables?
Thanks for help.
JasonHello,
Take a look into :-
http://www.sql-server-performance.com/sql_data_compare_review.asp
http://www.sqlteam.com/article/comparing-tables
http://weblogs.sqlteam.com/jeffs/archive/2004/11/10/2737.aspx
THanks
Hari
"Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
news:Oxik5IjrHHA.4108@.TK2MSFTNGP06.phx.gbl...
> Hi,
> In my SQL Server 2000, I have 2 Tables TableA and TableB.
> TableA and TableB have exactly same schema, and they all have 50
> datacolumns.
> However, the data in TableA and Tables are not the same, they are not copy
> to each other.
> Now comes my question, since they both have many columns, how do I compare
> the data for the two tables?
> Thanks for help.
>
> Jason
>|||Jason,
SchemaCrawler can compare a schema against a reference schema.
SchemaCrawler outputs details of your schema (tables, views,
procedures, and more) in a diff-able plain-text format (text, CSV, or
XHTML). SchemaCrawler can also output data for comparison (including
CLOBs and BLOBs) in the same plain-text formats. You can use a
standard diff program to diff the current output with a reference
version of the output.
SchemaCrawler is free, open-source, cross-platform (operating system
and database) tool, written in Java, that is available at
SourceForge:
http://schemacrawler.sourceforge.net/
You will need to provide a JDBC driver for your database. No other
third-party libraries are required. A lot of examples are available
with the download to help you get started.
Sualeh Fatehi.|||On Jun 13, 11:15 pm, "Jason Huang" <JasonHuang8...@.hotmail.com> wrote:
> Hi,
> In mySQLServer2000, I have 2 Tables TableA and TableB.
> TableA and TableB have exactly same schema, and they all have 50
> datacolumns.
> However, the data in TableA and Tables are not the same, they are not copy
> to each other.
> Now comes my question, since they both have many columns, how do Icompare
> the data for the two tables?
> Thanks for help.
> Jason
Jason - check out xSQL Data Compare at http://www.xsqlsoftware.com -
it does exactly what you want and it is free (to be more accurate you
have the full edition free for 2 weeks and after the two week period
is over then the Lite edition is free forever).
Thanks,
JC
xSQL Software
http://www.xsqlsoftware.com