Showing posts with label colums. Show all posts
Showing posts with label colums. Show all posts

Thursday, March 29, 2012

Comparing two databases

Hi,
I would like to compare two sql server databases.
I need to find the difference in the two database(i.e table, colums,
data type)
Is there any free utility available to compare sql server database
I'm using sql server 2000.
Help me out to compare databases

Thanks & Regards,
ManiIt's not free, but you can download a 14-day trial version;
http://www.redgate.com/products/SQL_Compare/index.htm
Markus|||Another one is AlfaAlfa's SQL Server Comparison Tool (SCT)

http://www.sql-server-tool.com
- also not free, but it has 30 days of free evaluation period, which
can be extended to 90 days. Comparisons can be fully automated
through the usage of command line parameters.

SCT works with SQL Server 2005, 2000 and 7.0 and between these
versions.

Dariusz Dziewialtowski.

Tuesday, March 27, 2012

Comparing table with excel spreadsheet

Hi all,

I have two tables in SQL Server 2005 and excel sheet ( Office 2003).

The colums of excel sheet are: name ,ssn, flagbit ( Note: Excel sheet contains data already)

Columns of table_one and table_two are: name ,ssn

I want to compare the ssn field from table_one and ssn in excelsheet_one, if it matches , then flagbit in excelsheet_one should say"T1".

If i compare ssn field from table_two and ssn in excelsheet_one, if it matches, the flagbit in excelsheet_one should say "T2".

Ex:

Table_one (input) - excelsheet_one ( Output)

ssn name - ssn name flagbit

11 NYC - 11 NYC T1

Both the tables refers same excelsheet_one and have to update the same flag bit column in excelsheet.

Basically, i want to compare table and excel sheet, then if it matches, then update excel sheet.

Does anybody how to do this.

Any help will be greatly appreciated.

Thanks

Export your table to excel and then do the work there.

Wednesday, March 7, 2012

Compare 2 DB

Hi,
I need to compare 2 DB (Tables, Colums etc) in order two calculate/determine
the difference between both, does somebody knows an aplication which is able
to do this? It would be great if this aplication would also be able to
create a script, after comparison, which aplies to one of the DB what the
other has differente/more. I hope I made understand myself!! :-) If the
aplication is able to compare two Tables would be enough.
I apreciate any help, thanks.
Marcelo
SQLCompare from www.red-gate.com is the tool I use for that.
Jacco Schalkwijk
SQL Server MVP
"Marcelo Moreira" <marcelo.moreira@.vpconsulting.pt> wrote in message
news:eoh%234BEYFHA.252@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I need to compare 2 DB (Tables, Colums etc) in order two
> calculate/determine the difference between both, does somebody knows an
> aplication which is able to do this? It would be great if this aplication
> would also be able to create a script, after comparison, which aplies to
> one of the DB what the other has differente/more. I hope I made understand
> myself!! :-) If the aplication is able to compare two Tables would be
> enough.
> I apreciate any help, thanks.
> Marcelo
>

Compare 2 DB

Hi,
I need to compare 2 DB (Tables, Colums etc) in order two calculate/determine
the difference between both, does somebody knows an aplication which is able
to do this? It would be great if this aplication would also be able to
create a script, after comparison, which aplies to one of the DB what the
other has differente/more. I hope I made understand myself!! :-) If the
aplication is able to compare two Tables would be enough.
I apreciate any help, thanks.
MarceloSQLCompare from www.red-gate.com is the tool I use for that.
Jacco Schalkwijk
SQL Server MVP
"Marcelo Moreira" <marcelo.moreira@.vpconsulting.pt> wrote in message
news:eoh%234BEYFHA.252@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I need to compare 2 DB (Tables, Colums etc) in order two
> calculate/determine the difference between both, does somebody knows an
> aplication which is able to do this? It would be great if this aplication
> would also be able to create a script, after comparison, which aplies to
> one of the DB what the other has differente/more. I hope I made understand
> myself!! :-) If the aplication is able to compare two Tables would be
> enough.
> I apreciate any help, thanks.
> Marcelo
>

Compare 2 DateValues -> maxvalue in transact sql

I need the maxvalue of 2 colums for each row

Select date1, date2, maximum(date1,dat2) as datemax.

Is this simple to realize ?

date1 and date2 can be NULL.

something like this:

select date1,date2, maxdate =
CASE
when date1 is null then date2
when date2 is null then date1
else
if date1 > date2 then date1
else date2
from xy

thanks for your help
paulYou could certainly use CASE

Here is a sample table with sample data

CREATE TABLE MyDatesTable(Date1 smallDatetime NULL, Date2 smallDatetime
NULL)
GO
INSERT MyDatesTable(Date1, Date2) VALUES(NULL,DATEADD(day,10,Getdate()))
INSERT MyDatesTable(Date1, Date2) VALUES(DATEADD(day,20,Getdate()),NULL)
INSERT MyDatesTable(Date1, Date2) VALUES(DATEADD(day,2,Getdate()),Getdate())
INSERT MyDatesTable(Date1, Date2) VALUES(Getdate(),DATEADD(day,4,Getdate()))

select
CASE WHEN Date1 IS NULL OR Date2 > Date1 THEN Date2
ELSE Date1
END as DateSelected
FROM
MyDatesTable

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org

"aaapaul" <lvpaul@.gmx.net> wrote in message
news:36648c93.0405030736.41de382@.posting.google.co m...
> I need the maxvalue of 2 colums for each row
> Select date1, date2, maximum(date1,dat2) as datemax.
> Is this simple to realize ?
> date1 and date2 can be NULL.
> something like this:
> select date1,date2, maxdate =
> CASE
> when date1 is null then date2
> when date2 is null then date1
> else
> if date1 > date2 then date1
> else date2
> from xy
> thanks for your help
> paul|||Are you in Austria?

On 4 May 2004 02:38:43 -0700, lvpaul@.gmx.net (aaapaul) wrote:

>merci vielmals.
>gruss
>aaapaul|||merci vielmals.

gruss
aaapaul|||Are you in Austria?

On 4 May 2004 02:38:43 -0700, lvpaul@.gmx.net (aaapaul) wrote:

>merci vielmals.
>gruss
>aaapaul

Compare 2 DateValues -> maxvalue in transact sql

I need the maxvalue of 2 colums for each row

Select date1, date2, maximum(date1,dat2) as datemax.

Is this simple to realize ?

date1 and date2 can be NULL.

something like this:

select date1,date2, maxdate =
CASE
when date1 is null then date2
when date2 is null then date1
else
if date1 > date2 then date1
else date2
from xy

thanks for your help
paulYou could certainly use CASE

Here is a sample table with sample data

CREATE TABLE MyDatesTable(Date1 smallDatetime NULL, Date2 smallDatetime
NULL)
GO
INSERT MyDatesTable(Date1, Date2) VALUES(NULL,DATEADD(day,10,Getdate()))
INSERT MyDatesTable(Date1, Date2) VALUES(DATEADD(day,20,Getdate()),NULL)
INSERT MyDatesTable(Date1, Date2) VALUES(DATEADD(day,2,Getdate()),Getdate())
INSERT MyDatesTable(Date1, Date2) VALUES(Getdate(),DATEADD(day,4,Getdate()))

select
CASE WHEN Date1 IS NULL OR Date2 > Date1 THEN Date2
ELSE Date1
END as DateSelected
FROM
MyDatesTable

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org

"aaapaul" <lvpaul@.gmx.net> wrote in message
news:36648c93.0405030736.41de382@.posting.google.co m...
> I need the maxvalue of 2 colums for each row
> Select date1, date2, maximum(date1,dat2) as datemax.
> Is this simple to realize ?
> date1 and date2 can be NULL.
> something like this:
> select date1,date2, maxdate =
> CASE
> when date1 is null then date2
> when date2 is null then date1
> else
> if date1 > date2 then date1
> else date2
> from xy
> thanks for your help
> paul|||merci vielmals.

gruss
aaapaul