Compare Two Databases Using Vbscript
Sep 9, 2004How to compare db2 and sql7 database using VB script
View 2 RepliesHow to compare db2 and sql7 database using VB script
View 2 RepliesHi,I have a field TestDescription in tableA in DatabaseA. The data in this field is coming from three different fields in three different fields in DatabaseB.Is there a way to write a script to check if the length of this field TestDescription is greater than length of all those three fields in DatabaseB?Thanks
View 1 Replies View RelatedIs there a way by which I can compare 2 databases?...I mean get to know, the differences in the 2 databases, so I can update the other, accordingly....?
Any suggestions would be appreciated.
Thanks in advance:-)
I have two databases - I will call them database A and database B.
I want to run some code on database A, and then check if database A became identical to database B.
How can I compare two databases? I want to compare them in terms of structure, not content.
Any suggestions? Thank you!
I have two databases - version 1 and version 2
I have the same table in both versions but the number of columns has changed from version 1 to version 2.
I can get the list of columns with:
select colid, name, col_text from _SCHEMA
where table_name like
'tableA' order by colid
How can I use something like this to compare tableA in dbo.1 to tableA in dbo.2 and just return the columns that exist in dbo.2 that aren't in dbo.1?
I thought something like this might do it, but I get major errors in execution:
use dbo.2 select colid, name, col_text from _SCHEMA
where table_name like
'tableA' and
name not in (use dbo.1 select name from _SCHEMA
where table_name like
'tableA')
order by colid
Hi
I want Tom Compare two databases to see if there are stroed procedure table that exist in one database
but not exist in the other.....
how do i do it?
Thanks
The following thread worked fine and i used this one for copying from one database to another database.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2494847&SiteID=1
Now one more question i would to confirm based on the above thread.
Suppose i have 2 records in database1.dbo.Department and 6 records in database2.dbo.Department.
I want to copy 2 records in database2.dbo.Department and 6 records in database1.dbo.Department.
It is just like comparing two databases.
Do i need to follow the same thread for copying databases which is above. I mean to say the same query.
How can i write script for comparing databases in terms of both schema and data.
Regards
Kashif Chotu
Hi,
I want to compare the production (say prod_db) objects against development database say dev_db.
In Oracle I would run a query using "minus" that is
select table_name from user_tables@prod_db
minus
select table_name from
user_tables@dev_db
what is the equivalent sql in t-sql(or are there any GUI tools to do this).I understand that from prod_db I need to create a link server to the dev_db to run such a query.
Thanks,
copernicus.
Can someone recommend what SQL Database compare tool to useand why?Thank you
View 1 Replies View RelatedHello,I wish to see if the tables from database A server A1 exist in databaseA on server B1.I setup a linked server from my first server (robertcamarda) to atarget (cognos-dev)This works from robertcamarda:select count(*) from [cognos-dev].ds_v6_source.dbo.stdmasand this works:select * from ds_v6_source.information_schema.tables order bytable_namebut this wont work:select * from [cognos-dev].ds_v6_source.information_schema.tables orderby table_nameError:Msg 117, Level 15, State 1, Line 1The object name 'cognos-dev.ds_v6_source.dbo.information_schema.tables'contains more than the maximum number of prefixes. The maximum is 3.I want to do something like:select * from ds_v6_source.information_schema.tableswhere table_name not in (select table_name from[cognos-dev].ds_v6_source.information_schema.tables order bytable_name)so I can see of the sql server (robertcamarda) has any missing tablesthat exist on the server (cognos-dev)TIARobSQL Server 2005 Enterprise
View 3 Replies View RelatedHello all!My question is: how to compare two database structures if I only havetheir DDL files? As the result I would expect an sql-script upgratingone database structure to another.The most 3rd-party tools I tested require connection to both databases.*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
View 1 Replies View RelatedHi,
I need to merge tables from several databases. Before the merge the table contents must be checked to rule out any duplicates.
Is there a most efficient way to do it? Thanks to you all.
How can I create a database link so that I can check data between 2 similar
SQL Server 7 databases ?
A customer has messed up while moving their databases. After working for a week they found that data is missing in the database.I have two backups, one from the old server and one from the new server today, they have been working in the new one for a week.
I need to compare these two databases and then update the new database with all data that is in the old one but not in the new database. Join the data in the two databases so to say. Both databases are from the same application so they use the same users, schema and so on.
Is there a way to compare two databases one being an olddatabase and the second being a new database, I willupdate the old database's objects to match the new database'sobjects?Is there SQL code that could do this easily?How do you do this if you deal with the same scenario?Thank you
View 2 Replies View RelatedI need to compare columns in tables on 1 database on one server versus the same on a 2nd server.
I'm looking for added columns in dbase 1.
Is there a system T-SQL script that can be used for this?
Is there any way to compare two similar databases (A & B) stored procedure. I have to find stored procedure in second database B with respect to the difference.
View 7 Replies View RelatedIs there an easy way to compare the contents of objects between 2 different databases? For example, say I had 2 databases, My_DB_1 and My_DB_2, each with a SEC_User table. Say I wanted to do an object-to-object comparison between databases to see if there were any differences. Here's some sample SQL:
use My_DB_1
select * from sys.dm_sql_referencing_entities('dbo.sec_user', 'object')
use My_DB_2
select * from sys.dm_sql_referencing_entities('dbo.sec_user', 'object')
Say that the result sets above both returned a SEC_GetUser sproc object ref. Is there a way to write SQL that will compare the SEC_GetUser sprocs (and other objects in the above rowsets) from both databases? For example, if My_DB_1.SEC_GetUser returns an extra column in the result set than My_DB_2.SEC_GetUser then I'd like my comparison SQL to return a single column "IsDifferent" with SEC_GetUser as a row....
I have an application written in C#, which allows the user to load their destination schema (in xml format) and writer their transformation expressions either in VBScript or in T-SQL. It uses DTS to do the ETL job.
Everything works great except with one problem. If there is a hypen ("-") in any of the destination attributes, the transformation fails with syntax error. It happens only with VBScript.
Here is my transformation:
"Function Main()
DTSDestination("Field-1") = #01/01/2004#
End Function"
If I replace the hypen with underscore, it works without any problem.
Does anyone have any idea about this problem?
How do i get my server to run a vbscript (yet to be created but i guess it will be in a DTS package???) when an insert runs on a table?
We need to analyse the browser versions hitting our intranet and catch the ones that are too old (earlier than IE5.5). I have the asp inserting a row with the IP address of the browser but i need to run a command line query to get the machine name from DNS (nslookup 111.222.333.444). This nslookup can be run from a vbscript.
Do i need to used a stored procedure in the process somewhere?
any thoughts welcomed
I am trying to write a DTS package at work that uses a loop to fire a query off against a different server/database at each loop iteration. Prior to the execute SQL task , I use ActiveX (VBScript) to change the Catalog and DataSource of the connection (created by drag and drop if icon). My Execute SQL task selects @@servername and getdate() just as a dummy query to make sure I am actually pointed at a different server.
While testing the properties of the connection using global variables and msgbox shows that the database (catalog) and server (data source) ip address is being changed, the result returned is always from the first server. I feel like I need to disconnect the connection object, change the parameters and then reconnect to the new server but there doesn't appear to be anyway to do this.
Anyone out there able to successfully change a connection object inthis manner??
I am trying to call a VB script file with the following command,
xp_cmdshell 'cscript c:file.vbs'
But its giving the following output -
Microsoft (R) Windows Script Host Version 5.1 for Windows
Copyright (C) Microsoft Corporation 1996-1999. All rights reserved.
NULL
Input Error: Can not find script file "c:file.vbs".
NULL
------------
If i changed the command to
xp_cmdshell 'cscript c:file.vbs'
it gives the folowing error -
Input Error: Can not find script file "C:WINNTsystem32file.vbs".
Actually my main intention is to call a url from the sql server where '
i can pass some value. Plz let me know if its the right step and whts
going wrong.
Thanks & regards,
-dkoushik
im writing a DTS package and i have am using vbscript to check if a file exists on an ftp server.
I can't figure out how to make my process sleep b/t checks on if the file exists.
in vb u can just
Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
but i cant seem to find a counterpart in vbscript.
thanks in advance,
pete
I have an SQL job that runs a .vbs script. It has the following code:
Cmd2.ActiveConnection = Conn2
Cmd2.CommandText = "USE msdb EXEC sp_update_job @job_name = 'Email Download',@enabled = 0"
Cmd2.CommandType = 1
Cmd2.Execute()
It's not disabling the job. If I execute in Query Analyzer, it works. I'm thinking it might be a permissions issue. Any suggestions?
TIA
I'm trying to run a TQSL script against a SQL Server 2000 database using SQL-DMO and Vbscript. The output of this query would be use to populate a table in another SQL Server database on a different server. Has anyone use SQL-DMO to connect SQL Server and run a t-sql script against a database and use the output to populate a table on a different server? Any informatiom would be helpfull.
Regards
Magictech
Hi All,I wrote a vbscript file which copies one table records to another database table. I wrote error handling to send an email if error occurs when copying records from one table to another. I want to schedule a sql job and give this file to execute. Could anyone plz tell me how to schedule sql job which runs vbscript file. i selected ActiveXScript and choose vbscript and gave path. I'm not understanding what the command should be given to run vbscript file. The result of giving path is job is failing.Any help would be appreciated...plzzzzzzzthankscarol
View 1 Replies View RelatedThis function is useful for fixed width output. E.g.
String(expr,10-len(expr),'0') will give you a number with leading zeros so it is always 10 characters long.
Thanks in advance for your time.
Ok, I've been charged with the task of setting up an IVR(interactive voice response) system for remote data entry. It was all going great till I got to the utility's Database connector. It wouldn't work, but I saw that the program also supported VBScript, great! I know VBScript.
Simple task, setup a simple flow where data can be entered. I setup a DSN for the access database(not quite MS SQL, but close enough) I'd created. It gave me a syntax error when I tried to use '' in an auto increment field. I think the exact query was:
"INSERT INTO test_table VALUES('',$RV[Store Number],'$RV[Objective]','question1','question2',question3');"
The database setup was:
id(AutoNumber),store_number(number),objective(text),q1(text),q2(text),q3(text)
Changed the auto number in the query to a 0 and it worked fine, but of course it was only to test if it would work. It would create a duplicate row if it went further than the first row.
I don't understand what my syntax error was. The $RV[*] are variables retrieved by procedures in the IVR scripting program. Need this for work so I can setup a demo of the system to present to my boss' bosses' bosses
Hello,
I am trying to call a Stored Procedure from VBScript. It worked fine the first time but each time after it doesn't seem to be returning any data is there any special command I need to send?
Thanks in Advance,
John
Hey guys,
I have a database import that I'm doing and I'm using DTS/VBscript to manipulate data.
I created a varchar field to import a date in the following format 030906.
Does anyone have a suggestion on making it 03/09/06?
Or just the best way to handle this type of data
thanks,
Jonathan
hi
I have a VBScript converted from an AccessDB Macro to VB.
Option Compare Database
'------------------------------------------------------------
' Macro2_Export2Text5
'
'------------------------------------------------------------
Function Macro2_Export2Text5()
On Error GoTo Macro2_Export2Text5_Err
DoCmd.TransferText acExportDelim, "", "MTHCrosstabCountingUnits", "c:IMSMthCountingUnit.txt", True, ""
DoCmd.TransferText acExportDelim, "", "MTHCrosstabValue", "c:IMSMTHValue.txt", True, ""
DoCmd.TransferText acExportDelim, "", "MATCrosstabValue", "c:IMSMatValue.txt", True, ""
DoCmd.TransferText acExportDelim, "", "MATCrosstabCountingUnits", "c:IMSMATCountingUnit.txt", True, ""
Macro2_Export2Text5_Exit:
Exit Function
Macro2_Export2Text5_Err:
MsgBox Error$
Resume Macro2_Export2Text5_Exit
End Function
What I am trying to do is instead of Opening the Access application and run the macro manually, i converted the macro to VB and created an ActiveX Script Task package in SQL2000 and Copy and Paste the VB Code to ActiveX Script Task. But it didn't work. Is there a work around for this?
Many thanks in advance.
I have a stored procedure that I run in Management studio just fine. I need to provide 2 integer variables @id and @version.How do I run the stored proc from vbscript and reading the output?
SP:
USE [ProjectBudget]
GO
DECLARE @return_value int,
@name varchar(500),
@maconomy varchar(100),
@creator varchar(100),
@created datetime,
@active bit
[code]....
Hi!
I'm trying to insert rows into an SQL Server table using a semicolon-separated text file as the source. The file continues approximately 4000 rows and I use the readLine() function to get the data ready for insert.
After reading a line I insert the row into SQL Server using a normal INSERT statement. I have tried this using only 100 test lines nand everything worked OK, but the first time I tried inserting all 4000 the web server seemed to go down.
Is this because SQL Server is not capable of such a bulk insert via web?
Is there something I could do to makes this easier?