Table Data Comparison
Jan 23, 2003
Hi,
Short version:
How would you accomplish comparing ALL the values in two tables wherein the PKs for each table are identical?
Long version:
SQL Server 2000 database with two tables
of identical structure having rows with some new data, some old data.* It's easy to determine which rows are 100% new by
looking for PKs not in the old data.
For the remaining rows, I need to make
certain no rows have been modified.
* Actually, there are hundreds of
pairs of tables as described.
The data comes from flat files, and I'd
rather use the database than Perl in this
case.
I can write code to generate the
list of columns for each table and then
query these as sets. Is there any
other method that might work better?
View 7 Replies
ADVERTISEMENT
Oct 3, 2000
Is there a way to compare two similar tables? I'm more interested in finding out if the data content is exactly the same or not between the two tables.
Thanks for your help.
View 1 Replies
View Related
May 15, 2008
Hi,
I have a table in sql server 2000.I delete some rows in the table.I would like to know the differences before & after deletion. Is it possible?
View 4 Replies
View Related
Jul 23, 2005
I have an Employee table with 3000 records and an Excel file having themodified data of those emplyoees. Some of the data of Excel may be sameas that of table data but some may differ. EmpId is the unique field.Other than this field, other fields of Excel may have modified data.Ineed to compare the data from SQL Server table with Excel Data.I decided to write a VB Program having two recordsets,one for SQLServer and other for Excel and compare each field's value. If themodified value is found then update that to table. Is there any way tocompare in SQL Server itself?Madhivanan
View 2 Replies
View Related
Mar 16, 2006
Hello All,
I have two tables T1 and T2 with the same data structure. I need to compare T1 with T2 for all columns and update T2 for deleted, inserted and updated rows. How can I do this?
View 4 Replies
View Related
Mar 21, 2006
I am not sure if this is the correct forum for my question but I will give it a shot. I want to be able to create a dataset from an ODBC datasource and compare it to existing data in my SQL DB. If there are changes (inserts/updates/deletes) I want to raise seperate events for each row state. Is this possible to do with SSIS/DTS or am I on the wrong track with what I am trying to do?
View 7 Replies
View Related
Jan 25, 2007
Is there a transform available which allows you to specify two different tables (same primary key) and compare columns (you identify which column(s) values need to be compared in the transform) between those two tables?
thanks
View 11 Replies
View Related
Dec 15, 2007
Hi everybody,
I'm having trouble creating a seemingly simple Comparison report.
I want to be able to create a Table or Matrix that displays the number of items for the Current Year, the Previous Year, and the Difference. I was able to write a script that gives me the count for each item, for each year, as illustrated below:
Item
WhichYear
Count
Apples
Current Year
2
Apples
Previous Year
2
Mangos
Current Year
214
Mangos
Previous Year
204
Oranges
Current Year
13
Oranges
Previous Year
20
Pears
Current Year
19
Pears
Previous Year
50
Strawberries
Current Year
28
Strawberries
Previous Year
40
Ideally, the report Layout look like this, with a column for each year, and a separate column for the difference:
Item
Current
Previous
Difference
Apples
2
2
0
Mangos
214
204
10
Oranges
13
20
-7
Pears
19
50
-31
Strawberries
28
40
-12
Sounds simple enough to me. But when I put it in a Table, I can't get the counts for the Current and Previous Years on one line per item. They end up broken down into two lines (as illustrated in the first chart). When I try to add a grouping, it somehow holds onto the Current Year numbers and ignores the Previous Year numbers. When I put it in a Matrix, I can't seem to write a simple calculation, like finding the Difference between the two columns. Can I add a non-pivot row or column to the matrix?
I know this is a very general question... Any idea on whether I should go for a Table or a Matrix or another approach, like a summary table?
Thank you very much in advance,
- Trevor
View 2 Replies
View Related
Aug 18, 2006
Hi ,
Can any one give a summary of difference between Data Stage and SSIS . we are in process of Migrating existing Jobs in Data Stage to SSIS .so i am prepareing a comparitive report between Data Stage and SSIS . help us pls
Jegan
View 1 Replies
View Related
Nov 10, 2015
I upload data from a Txt File(Txt_Temp) where I have VinNumber with 6 digits. Another table name Resrve_Temp1 where I have Vinumber with 17 digit. Now I need to update the vinnumber 6 digit to 17 digit or to new column in Txt_temp.
Txt_Temp - Table
I tried this code with no succes and only one row is updating
update Txt_Temp Set Txt_Temp.Vinnumber=dbo.R_ResrvStock.Vin
from dbo.R_ResrvStock inner join Txt_Temp on Right (dbo.R_ResrvStock.Vin,6)=Txt_Temp.VinNumber
OR Add this code in view
Select dbo.R_ResrvStock.Vin,R_Txt_Temp.Vinnumber,R_Txt_Te mp.Model_Code
from dbo.R_ResrvStock inner join R_Txt_Temp on Right (dbo.R_ResrvStock.Vin,6)=R_Txt_Temp.VinNumber
Vin
123456
123123
123789
Resrve_Temp1 - Table
asddfghjklk123654
asddfghjklk123456
asddfghjklk321564
asddfghjklk123123
asddfghjklk123789
asddfghjklk654655
asddfghjklk456465
My Result can be in Txt_Temp table or new table or with one or two columns
asddfghjklk123456 123456
asddfghjklk123123 123123
asddfghjklk123789 123789
View 10 Replies
View Related
Jun 9, 2014
I am having a problem in creating query for this exciting scenario.
Table A
ID ItemQtyCreatedDatetime
W001 CB112014-06-03 20:30:48.000
W002 CB112014-06-04 01:30:48.000
Table B
IDItemQtyCreatedDatetime
A001 CB112014-06-03 19:05:48.000
A002 CB112014-06-03 20:05:48.000
A003 CB112014-06-03 21:05:48.000
A004 CB112014-06-04 01:05:48.000
A005 CB112014-06-04 02:05:48.000
I would like to return the nearest date of Table B in my table like for
ID W001 in table B should return ID A002 CreatedDatetime: 2014-06-03 20:05:48.000
ID W002 in table B should return ID A004 CreatedDatetime: 2014-06-04 01:05:48.000
View 3 Replies
View Related
Jul 20, 2005
I've been testing a variety of database schema migration tools. Ourcompany purchased Embarcadero Change Manager a while ago but we'vebeen less than satisfied with the results.We are looking for a tool that can compare a source/developer databasewith a target/client database and then make the necessary changes.The tool will need to update stored procedures, tables, indexes,constraints, etc. The tool will also need to make the changes in thecorrect order based on dependencies and relationships.Anyone have any recommendations?
View 1 Replies
View Related
May 25, 2015
I have a requirement to compare data between two tables in SQL Server.
What is the fastest way to do it using SSIS? There are approx 6~7 millions of records in each table.
My solution: Read both the tables and store the data in Object Type variable. Then run an except query. But I am stuck at except query part. How do I implement it?
View 5 Replies
View Related
Oct 20, 2015
I need to take all records from table @A where ID = 1. Also i need to process the records with datewise from table @A. Here is the table structure
DECLARE @A TABLE (ID INT, ACCOUNT VARCHAR(10), EFFDT DATE)
INSERT INTO @A VALUES (1,'AAA','2015-10-01')
INSERT INTO @A VALUES (1,'BBB','2015-10-01')
INSERT INTO @A VALUES (1,'CCC','2015-10-01')
INSERT INTO @A VALUES (1,'AAA','2015-10-05')
INSERT INTO @A VALUES (1,'DDD','2015-10-01')
INSERT INTO @A VALUES (2,'AAA','2015-10-02')
INSERT INTO @A VALUES (2,'BBB','2015-10-02')
INSERT INTO @A VALUES (2,'CCC','2015-10-02')
INSERT INTO @A VALUES (2,'DDD','2015-10-02')
[code]...
how to achieve this in SQL query, i cannot use CTE or temp table as i need to use this code in another tool, it has to be single query, can use subquery or join would be better.
View 4 Replies
View Related
Aug 18, 2014
I am comparing two fields one from our legacy table and one in our new table structure that should have identical text data. The new field has an assortment of ANSI characters where the legacy data did not have these. Is there anything I can do that will ignore all ansi character differences? The only route I can think of is just do a replace on each ANSI type on the new column but there are quite a few character types.
View 4 Replies
View Related
Nov 2, 2014
In my TSQL code i use a derived table to extract the value of account 321 to compare if they are the same that the SUM of my line invoice cost multiply by quantity line : Sum(fi.ecusto*qtt)
This is my script:
SELECT ft.ndoc [Doctype],ft.fno [Docnr] , Sum(fi.ecusto*qtt) [totalcostof my Invoiceline], xctb.conta [accountancy account],
sum(Case when ft.tipodoc = 1 then Xctb.ecre else Xctb.edeb end) as [Value of Cost of invoice in accountancy],
[DIF] = Sum(fi.ecusto*qtt) - Sum(Case when ft.tipodoc = 1 then xctb.ecre else xctb.edeb end)
[Code] ....
My problem is if i have more than on line on my invoice, for example 2 lines, the value of column [Value of Cost of invoice in accountancy] are duplicated, for 3 line invoice the value are multiply by 3.
View 7 Replies
View Related
Apr 2, 2007
Hi,
Let's say I have 1000 registered users in database table and each of them has numeric ranking value.
How can I get the position of each user in comparison to other users ranking value?
View 6 Replies
View Related
May 27, 2008
Parameter
Access 2000/XP
SQL Server 7.0
SQL Server 2000
MSDE 2000
Number of instances per server
n/a
n/a
16
16
Number of databases per instance / server
n/a
32,767
32,767
32,767
Number of objects per database
32,768
2,147,483,647
2,147,483,647
2,147,483,647
Number of users per database
n/a
16,379
16,379
16,379
Number of roles per database
n/a
16,367
16,367
16,367
Overall size of database (excluding logs)
2 GB
1,048,516 TB
1,048,516 TB
2 GB
Number of columns per table
255
1024
1024
1024
Number of rows per table
limited by storage
limited by storage
limited by storage
limited by storage
Number of bytes per row
(Excluding TEXT/MEMO/IMAGE/OLE)
2 KB
8 KB
8 KB
8 KB
Number of columns per query
255
4,096
4,096
4,096
Number of tables per query
32
256
256
256
Size of procedure / query
64 KB
250 MB
250 MB
250 MB
Number of input params per procedure / query
199
1,024
2,100
2,100
Size of SQL statement / batch
64 KB
64 KB
64 KB
64 KB
Depth of subquery nesting
50
32
32
32
Number of indexes per table
32
250 (1 clustered)
250 (1 clustered)
250 (1 clustered)
Number of columns per index
10
16
16
16
Number of characters per object name
64
128
128
128
Number of concurrent user connections
255
32,767
32,767
5
View 1 Replies
View Related
Sep 20, 2007
I am attempting to create a stored procedure that will launch at report runtime to summarize data in a table into a table that will reflect period data using an array type field. I know how to execute one line but I am not sure how to run the script so that it not only summarizes the data below but also creates and drops the table.
Any help would be greatly appreciated.
Current Table
Project | Task | Category | Fiscal Year | Fiscal Month | Total Hours
---------------------------------------------------------------------------------------------------------
Proj 1 | Task 1 | Cat 1 | 2007 | 01 | 40
Proj 1 | Task 1 | Cat 2 | 2007 | 02 | 20
Proj 1 | Task 1 | Cat 3 | 2007 | 03 | 35
Proj 1 | Task 1 | Cat 1 | 2008 | 01 | 40
Proj 1 | Task 1 | Cat 2 | 2008 | 02 | 40
Proj 1 | Task 1 | Cat 3 | 2008 | 03 | 40
Proposed Table
Project | Task | Category | Fiscal Month 01 | Fiscal Month 02 | Fiscal Month 03 | Fiscal Year
---------------------------------------------------------------------------------------------------------------------------------------------------
Proj 1 | Task 1 | Cat 1 | 40 | 0 | 0 | 2007
Proj 1 | Task 1 | Cat 2 | 0 | 20 | 0 | 2007Proj 1 | Task 1 | Cat 3 | 0 | 0 | 35 | 2007
Proj 1 | Task 1 | Cat 1 | 40 | 0 | 0 | 2008
Proj 1 | Task 1 | Cat 2 | 0 | 40 | 0 | 2008
Proj 1 | Task 1 | Cat 3 | 0 | 0 | 40 | 2008
Thanks,
Mike Misera
View 6 Replies
View Related
Aug 18, 2015
How to purge data in transaction table or we can delete some data and store in separate table in data warehouse?
View 7 Replies
View Related
Nov 23, 2000
Dear All
I am new to the topic T-SQL.
I am trying to use T-SQL to merge the content of two tables (table1 and table2) into one table making sure there are no duplication.
I wonder if any body can let me have a simple code.
Best Regards
Saad
View 1 Replies
View Related
Sep 13, 2007
Hey guys what would be the easiest way to create a report of value changes for particular records from one day to the next..... ?
Any suggestions would be greatly appreciated....
thanks,
Jonathan
View 2 Replies
View Related
Aug 8, 2006
Hi there! can anyone help me out??? I need to compare a date from the database and the system date which will be coded in a store procedure in SQL... HELP!!!!!
View 5 Replies
View Related
May 21, 2008
I have a table with a field with a bit datatype. When I execute the stored procedure line if @bitvalue = 1 begin ...
and the value is passes as 0 the statements beneath the begin execute. What am I doing wrong?
View 4 Replies
View Related
Jun 27, 2000
Hi...
I have a problem comparing dates in SQL Server 7.
I want to find results where date1 = date2.
I am having problems becausing SQL is also trying to compare the time which
is included in the field value e.g. 03/04/00 12:01:32
So even if the dates are equal the time may be different so the results are not shown?
I've tried SUBSTRING, and CONVERT,CAST etc.. and still can't get it to work
Any ideas???
Thanks.
View 1 Replies
View Related
Aug 19, 2003
We are converting our project into new version. They have done lot of changes in new version including normalization/denormalization. I need to compare the old and new database.
Do you have any standard script or procedure like SQL Compare software?.
Let me know what are the possibilties we need to check.
Your help appreciated.
Thanks,
Ravi
View 5 Replies
View Related
Oct 23, 2003
Good day,
I am receiving garbage data from my other department as follows.
I want:
'12/05/03' for example.
I get:
'//'
'00/00/00'
And other garbage. All of which crashes the transaction because it cannot be converted to Datetime.
What I would like to do is something like this:
IF @v_date > '01/01/50'
BEGIN <-- statement will crash if bad data)
Something to trigger a Boolean (True/False) validation of the data.
I want to know if it is even a date before I run it through my block.
Any thoughts?
I don't want to add a new IF block for every bizarre thing they send me.
Thanks ahead of time.
PS - I guess I could just raise an exception and handle it in a block that way, but am still curious.
View 3 Replies
View Related
Dec 11, 1998
Hi friends,
How can I do, in one Trigger, to returns if two columns, one of the Inserted and other of the Deleted, are differents ? I used this example:
If ( select Name from inserted ) !=
( select Name from deleted )
Insert Into Log_System
( Key_Mame, User_Name, Date, Field, Value, Table_Name )
Select 'COD. PROD: ' + Convert( char(10), I.Cod_Prod ),
SUSER_NAME(), GetDate(),
'Name', Convert(Char(255), D.Name ),
Convert(Char(255), I.Name), 'U', 'PRODUCTS'
From Inserted I, Deleted D
But, if one of them is Null, then the comparison result returns FALSE.
Examples:
1 - If in the Table are keeped null and the new value is different of Null
the comparison result returns FALSE.
2 - If in the Table are keeped a value and the new value is null the
comparison result returns FALSE too.
Excuse me, my English is not currently.
Thanks !
Rodney.
View 2 Replies
View Related
May 15, 2001
Hi,
Assuming a table with a column defined char or varchar.
I have a SQL query like this :
Select * from table1 where column1='Building'
It returns the same result that
Select * from table1 where column1='BUILDING'
It is my understanding SQL Server (verison 7 or 2000, I tried on both) is lower/capital insensitive by default when it is installed. If I want SQL Server to be case-sensitive with my char or varchar columns, where can I set it?
Is it at database level or server level I can find this setting . What is the setting that control it?
Best Regards,
Alain Gagne, Lead DBA
gagnea@msagroup.com
View 3 Replies
View Related
Jan 12, 2006
Hello im trying to run a simple query where i compare something simple like BEARING to a field in the database using this query.
Code:
SELECT table1.STK_NO, table1.STK_NO2
FROM table1
WHERE (LEN(CLEANSED_REF)>2)
AND ('BEARING' LIKE '%'+table1.CLEANSED_REF+'%')
Inside the table i can see the CLEANSED_REF field and its value is "000BEARINGBRNG000". When i run the query i get no records returned.
But if i run
Code:
SELECT table1.STK_NO, table1.STK_NO2
FROM table1
WHERE (LEN(CLEANSED_REF)>2)
AND (table1.CLEANSED_REF LIKE '%BEARING%')
The query returns the row i wanted. Can anyone tell me why this wont work the first way, but works the second?
View 4 Replies
View Related
Aug 13, 2004
Morning!
Folks, i want some links where i could find healthy stuff regarding New Features and Compliance levels, performance comparisons, TPC tests etc about SQL 2000 and Yukon specially.
I've to submit a document regarding Top database features that shall be used for a Medical-Billing Software in plan.
Howdy!
View 2 Replies
View Related
Dec 28, 2005
I have two tables that I am needing to link by the tables date field. In one table the date field is defined as varchar(23). The time for this field is always zeros.
Example: '2005-12-27 00:00:00.000'
The other table is defined as datetime, and it does have the date and time in this field.
Example: 2005-12-27 08:00:35.000
The problem i am having is
2005-12-27 00:00:00.000 does not = 2005-12-27 08:00:35.000.
Because I will never have more than one record on the same date I would like to be able to only compare the date. Example 2005-12-27 = 2005-12-27
Since the fields are 2 different field types, this is giving me a problem. Could someone please help. I have tried everything I know to do.
What I really need is the a way to format the datetime fields date into a string such as '2005-12-27'.
Hopefully what i have written makes sense.
Thanks
View 3 Replies
View Related
Oct 4, 2006
I had an application go down yesterday...it was giving a Type Mismatch error and the support team couldn't figure it out.
My suspicion is that a field in the database got populated with a character the vb app didn't like when it renders the information.
I'd like to prove that theory...but the database is large (4gb) and I'm not sure how to do a database comparison to see where the records differ.
Anybody have a script to get me started OR some experience to share?
Thanks,
Alex8675
View 1 Replies
View Related