Showing posts with label periodically. Show all posts
Showing posts with label periodically. Show all posts

Thursday, March 22, 2012

comparing data between two tables...

I would like to compare data across two tables. I have part
information in a table. I get a new set of information periodically.
I would like to compare my new info to my old info. I recognize that
doing a compare of every attribute of every part will take FOREVER. Is
there some way I can do a "diff" based on the columns that I care
about?

Thanks!

--gloria"gloria" <gurbanic@.gmail.com> wrote in message
news:1108584926.680623.281960@.g14g2000cwa.googlegr oups.com...
>I would like to compare data across two tables. I have part
> information in a table. I get a new set of information periodically.
> I would like to compare my new info to my old info. I recognize that
> doing a compare of every attribute of every part will take FOREVER. Is
> there some way I can do a "diff" based on the columns that I care
> about?
> Thanks!
> --gloria

No idea - your desciption isn't very clear (to me), so I suggest you post
some CREATE TABLE and INSERT statements to show exactly what you want:

http://www.aspfaq.com/etiquette.asp?id=5006

But in general, you can do something like this:

select *
from dbo.MyTable1 t1 join dbo.MyTable2 t2
on t1.KeyColumn = t2.KeyColumn
where t1.col1 <> t2.col1
or t1.col2 <> t2.col2
or ... /* other columns here */

Simon|||Simon,

Your general code snippet tells me what I need to do. Thanks.

--gloria

ps. Thanks for the etiquette tip. I will do this in future. :)

Tuesday, March 20, 2012

Comparing 2 files

Dear All,
Periodically, i need to copy a file from the source folder to destination
folder. the source file will be updated from time to time. Before copying
the file to destination folder, i need to compare the modified date of the
file, mean only copy the file to destination folder if the source file is
updated. How can we do this in SQL?
I will use the xp_cmdShell to copy the file. If use the xp_getfiledetails,
how can i get the information return fromt the stored procedure to check the
modified date? Or, is there any better method of doing this?
I am using SQL Server 2000.
Thanks & Best Regards,
EdwardInsert as below..and then you can compare ..
CREATE TABLE #FILE
(
name varchar(30) null,
size int null,
creationdate int null,
creationtime int null,
lastwrittendate int null,
lastwrittentime int null,
lastaccesseddate int null,
lastaccessedtime int null,
attributes int null
)
INSERT #FILE EXEC master..xp_getfiledetails @.FILE_NAME
MJKulangara
http://sqladventures.blogspot.com|||Hi
You could do the file copy and comparison using a DTS package and an ActiveX
script. See
http://www.sqldts.com/default.aspx?292
John
"Edward Low" <wc_low@.hotmail.com> wrote in message
news:eRZ8g9qLGHA.3936@.TK2MSFTNGP12.phx.gbl...
> Dear All,
> Periodically, i need to copy a file from the source folder to destination
> folder. the source file will be updated from time to time. Before copying
> the file to destination folder, i need to compare the modified date of the
> file, mean only copy the file to destination folder if the source file is
> updated. How can we do this in SQL?
> I will use the xp_cmdShell to copy the file. If use the xp_getfiledetails,
> how can i get the information return fromt the stored procedure to check
> the modified date? Or, is there any better method of doing this?
> I am using SQL Server 2000.
> Thanks & Best Regards,
>
> Edward
>