How To Compare Database Structures?
Jul 20, 2005
Let us suppose that I have two similar databases and need to create an
sql-script upgrating one database structure to another. For example, these
databases are from different versions of some software, first is from early
version, next is from current, and second one contains several new tables,
sevelal new fields in old tables, several new or changed stored procedures,
UDFs and so on.
How to solve this problem using standard tools?
View 6 Replies
ADVERTISEMENT
Apr 1, 2008
Hi All,
I have 2 tables in different database. I need to compare the tables structure and insert the fields if not existing.
Ex:
I have 3 fields in table1.(database name Pubs)
Table1
F1
F2
F3
I have 2 fields in table2.(database name northwind)
Table2
F1
F2
I need to insert the table1.F3 into Table2. Basically i need to compare all the fields with table1, if not exist in table1 i need to insert that field into table2. I am using SQL Server 2000. Please send me the code.
Thanks,
Mears
View 7 Replies
View Related
Apr 28, 2006
I am having a hard time finding materials on this subject. I am guessing I am using the wrong keywords to search. Basically, I want to be able to modify database tables through a web form. They can add columns and delete columns through the form. I would just want to default the type of column and the length. I am sure it has been done, I was just wondering if anyone had some resources they could throw my way. I would appreciate it. Thanks.
View 1 Replies
View Related
Aug 7, 2007
Hi all expert,
Question as stated title above, how do I duplicate the table structure to another database whether it copies all columns, primary and foreign keys, default values, descriptions, constraints, indexes
Many thanks for the help.
regards,
View 8 Replies
View Related
Sep 26, 2006
We have databases with large numbers of tables. We have a separate database for each year. For various reasons, we need to export about 100 of the tables (Structure only, not their data) from last years database into this year's database. What is the best method for doing this? The import/export wizard creates the tables but does not bring in important things like keys.
Regards Shirley A
View 3 Replies
View Related
Apr 10, 2008
I am trying to use the Import Wizard to setup a daily job to import new records based on an ID field (PK). The source database is remote and a replica. I am inserting new records to update my table called the same thing. Both are SQL Native Client
Code Snippet
select *
from [CommWireless].[dbo].[iQclerk_SaleInvoicesAndProducts] as S1
join [IQ_REPLICA].[dbo].[iQclerk_SaleInvoicesAndProducts] as S2
on S1.SaleInvoiceID = S2.SaleInvoiceID
where S1.SaleInvoiceID > S2.SaleInvoiceID
When I parse the query, I keep getting an error message.
Deferred prepare could not be completed.
Statement(s) could not be prepared.
Invalid object name 'IQ_REPLICA.dbo.iQ_SaleInvoicesAndProducts'. (Microsoft SQL Native Client)
Anyone know an easy why to get this to work? Or should I add a create table to verify new records?
View 8 Replies
View Related
May 14, 2008
i am making a transaction function for my website, when people transfer an amount from account A to account B, it should check the amount if account A has enough money to transfer. here is my codes, should i add an if statement before the tra.update()? how to write this codes? SqlDataSource tra = new SqlDataSource(); tra.ConnectionString = ConfigurationManager.ConnectionStrings["shuliConnectionString"].ToString(); tra.UpdateCommand = "update account set balance=balance" + -Convert.ToDecimal(TextBox5.Text) + " where AccountNumber = '" + TextBox3.Text + "'"; tra.Update(); tra.UpdateCommand = "update account set balance=balance+" + Convert.ToDecimal(TextBox5.Text) + "where AccountNumber = '" + TextBox4.Text + "'"; tra.Update(); tra.InsertCommand = "insert into Transactions(TransactionType,AccountNumber,DestAccount,Amount,Comment,ModifyDate) values ('T','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox2.Text + "','" + DateTime.Now.ToLocalTime() +"')"; int inertRowNum = tra.Insert(); Server.Transfer("deposit_withdraw_confirm.aspx");
View 5 Replies
View Related
Jul 19, 2006
what is the best tool to compare to sql database structure and if i want to do it programaticaly by c# and sql smo is there any sample in this project
View 2 Replies
View Related
Dec 21, 2006
Language : VB.NET
Database : MSSQLserver2000
i have developed a tool to compare two databases, but it is taking long time to compare. First it will take the whole table into main memory(order by primary key). Same procedure for table2 of second database. Then it will start comparison by taking row by row. i tested with one third party tool, which is taking only 2 min to compare 800000 records of a table. My tool is taking 1 hour,40 mins to do that. Is there any other optimized method?
Regards,
Loka
View 13 Replies
View Related
Oct 3, 2006
I have one databaseand I create new database by copy everything from first db I then alter some column on new database and now I would like to compare two databaseHow can I do it ?
View 4 Replies
View Related
Nov 17, 2006
We're using Sql Server 2000. The one database contained tables and stored procedures which were possibly updated with some script information. Is there an application(commercial or free) or script I can use to compare the base database against this updated database to confirm there schema information is the same.
Thanks
View 1 Replies
View Related
Jan 11, 2008
Here's my scenario. I've got an web site that is going to allow access across two different domains. So I pull out the user name and domain with a split. At that point I want to say If user name = a value in bug_user table then redirect ~default.aspx Else redirect to other page. I'm kind of stuck. Here is what I got so far. Imports System.DataImports System.Data.SqlClientPartial Class MasterPage Inherits System.Web.UI.MasterPage Sub page_load() Dim user As System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User Dim username As String username = user.Identity.Name Dim namer As String Dim domain As String Dim firstname As String namer = username.Split("")(1) domain = username.Split("")(0) Dim objcon As ConnectionStringSettings = ConfigurationManager.ConnectionStrings("bug_trackerConnectionString") Dim str As String = objcon.ConnectionString Dim con As New SqlConnection(str) Dim com As New SqlCommand("", con)?????????????????????????? con.Open() com.commandText = "Select FirstName, LastName, Userid, Domain from bug_user" con.Close()??????????????????????? Between the question marks is where i start to get lost. I don't know how to look into the column Userid in the table bug_user table to see if my variable namer is present and I don't know where I should start my if statement. Thank for your help.
View 1 Replies
View Related
May 15, 2008
How could i compare value or string in my database with text in textbox1 before i inserted in the same database ?
View 5 Replies
View Related
Jun 21, 2005
Can anyone recommend any utilities which compare 2 databases and report on the differences? A developer would like to compare the before/after images of a database once an upgrade has been applied.
He has looked at Red Gate ( http://www.red-gate.com/SQL_Data_Compare.htm ) and would like any recommendations about this product or any other.
Thanks.
Joseph
View 3 Replies
View Related
May 23, 2007
Greetings All,
I have a SQL Server 2005 DB that contains a version number that is specific to its schema. I have an SSIS package that performs an export/import of user data. I need to be able to compare the DB version number of both the target and the source database before the migrate operation can continue. Does anyone know if there is a Control Flow Task (or some other task) to do such a thing or will I need to write a custom Script Task?
Any help at all would be greatly appreciated.
Thanks!
View 12 Replies
View Related
Apr 9, 2008
Hello, I am writing a website (in vb) to allow for room use reservations and I am looking for a way to compare the selected start and end times which are date-time format to records already in the database for that day/time and specific room. If the selected time does not fall within an already reserved time frame I then want to insert it into the table. I have already written a procedure to do the inserting and that works fine. I just want to validate it before calling the insert. Any ideas? The fields to be validated on the form are textboxes containing date time which populate as read only after the time selection is chosen from dropdown. Thanks in advance It's greatly appreciated.
View 7 Replies
View Related
Feb 28, 2000
We have three database server . Development, Test and Production. would appreciate if any body could receommend utilities/ways to compare apart from sqlcomp or ERWin
regards
rajeev
View 1 Replies
View Related
May 28, 2014
I want to compare the database structures(columns,datatypes..etc) across same databases located in different servers.
View 9 Replies
View Related
Jul 20, 2005
Hello. I have an information question. In my work I often have tocompare databases between releases in order to upgrade them to neededversion of software we developing.And I am looking for software that could do that. It doesn't have tobe free, but have to be good.I need to be able to compare table structures, amount of rows,procedures, triggers.I found one: Red Gate , but I am not sure that it is the best in themarket, and it is pretty expensive too.Any suggestions are appreciated.Thank you in advance.
View 3 Replies
View Related
Sep 23, 2015
I have 2 database, databaseA and DatabaseB with same table structure.
I change lot of table structure in databaseB.
So i want compare what field that i add or delete in databaseB.
it's like what field there are in databaseB and not found in databaseA or nothing in databaseB but exist in databaseA.
How can i do that?
View 7 Replies
View Related
Sep 7, 2006
how to synchronize and compare two database in sql server 2000 without using any others software in real time.
my purpose is to check the two database in two different server if there has any different. And synchronize these two database continusly.
if one database had change, the other will also change
View 4 Replies
View Related
Sep 7, 2006
how to synchronize and compare two database in sql server 2000 without using any others software in real time.
my purpose is to check the two database in two different server if there has any different. And synchronize these two database continusly.
if one database had change, the other will also change
View 3 Replies
View Related
Jun 10, 2015
I need to pull dates from a DB2 database via TSQL (Linked server - IBM DB2 for i IBMDASQL OLE DB Provider) and compare it to today for a less than or greater than type comparison.
Database: DB2, Customer information housed here
Columns:
UTOFMM - Month (2 character, numeric)
UTOFDD - Day (2 character, numeric)
UTOFYY - Year (2 character, numeric. Problem: years from 2000 to 2009 are stored as 0, 1, 2, ... etc)
UTOFCV - Century Value (2 char, numeric. 0 = before 2000, 1 = in or after 2000)
I need to concatenate the date to be "sql" friendly, and then compare to today's date. It's to find any customer with date values in the fields above, and then differentiate between dates before today and after today.Here is the snippet of what I'm trying to fix. This portion of a nightly job is just checking for <u>any</u> value in the UTOFMM column of the current record.
Add Customer ID
Update [responder].[Temp_RX_CUSTOMERS]
set CustomerID = lf.UTCSID
from [responder].[Temp_RX_CUSTOMERS] LEFT Outer Join
[HTEDTA].[THOR].[HTEDTA].UT210AP lf ON [responder].[Temp_RX_CUSTOMERS].LocationID = lf.UTLCID
where lf.UTOFMM = 0
GO
View 4 Replies
View Related
May 17, 2008
I'm not a full-time DBA, so excuse my style of expressing my question.I have a database which has 2 tables in SQL 2005. Both these tables have similar column names, EXCEPT for new extra columns in FY2007_DATA. I can visually see the difference in columns in Database Diagrams. My goal is to :- I want to compare FY2007 tbl column names to FY2006 column names and display only those columns as results that do not match.Tbl 1 :- FY2006_DATA Tbl 2:-
FY2007_DATA
With online reading and help I have managed to get this script to do exactly opposite of what i want. Below is the query
/* This query compares the column names from two tables and displays the ones that have an exact match. It does not care for case-sensitiveness */
Select a.Table_Name, a.Column_Name, (b.Table_Name), (b.column_name)
From [2006-2011].INFORMATION_SCHEMA.Columns AS a
Join [2006-2011].INFORMATION_SCHEMA.Columns AS b on a.Column_Name = b.Column_Name
Where a.TABLE_NAME = 'FY2006_DATA'
And b.TABLE_NAME = 'FY2007_DATA'
AND a.Column_Name IN
(Select Column_Name = LEFT(c.column_name, 20) FROM
[H1B_2006-2011].INFORMATION_SCHEMA.Columns AS c WHERE c.TABLE_NAME = 'FY2007_DATA' )
When I change "AND a.Column_Name IN.." to "AND a.Column_Name NOT IN.." so that the results will (should) display the extra columns in FY2007, in fact I do not see any results, but query executes perfect.
How can I achieve my goal.?
Thank you
View 1 Replies
View Related
Apr 14, 1999
I have 2 test database identical in size and table structure, only one resides on filegroups and one resides on a single file.
From everything I have heard filegroups are suppose to improve performance. I stop and start the server before each test to clean out
cache. When I run the filegroup test initially the first run averages 20 seconds slower then the database sitting on the single file. However
on consective runs there is a significant improvement in performance with filegroups verses single files. I have
the indexes sitting on a separate filegroup and 2 additional filegroups to spread the tables across. Does any one know what would be causing
the performance to degrade on the initial run of the test. (The test by the way is a stored procedure that runs a select statement against each table).
Any Info Will help Thanks
Barb
View 3 Replies
View Related
Jun 11, 2006
Hi,
i'm writing a app in c# and have to store Trees in a Database.
I'm working with Datasets for the exchange between the DB and the App.
The trees have the same options like the windows folders. If u delete a node, all subnodes should be deleted too.
But something a Foreign Key from ParentID references (Id) with the delete-Rule on cascade seems not to be possible, because of multiple cascade Paths or cycles. Do i have to add some xtra constarins:
Not Possible:
create Table tree (
Id varchar Not null,
ParentId varchar Not null,
Constraint pk1 Primary Key (Id),
Constraint fk1 Foreign Key (ParentId) references tree(Id)
On Update Cascade
On delete CAscade
)
Do i have to write triggers, which delete The subnodes too and set the Update-/deleterulr on NO Action
Greetz
View 1 Replies
View Related
Oct 24, 2006
Does anyone know any good links for SQL tree structures and example queries and stuff... I cant really find anything part from the standard example of emplyee, boss, salary which explains how to create the tree table...(dun dis bit) I did notice a book but I live in a little village so cant go get it till wekend?
I'm desperate, reli need to work out how too do this.....
View 14 Replies
View Related
Nov 14, 2006
(Wow; surfing this site has really illuminated what a lowly hack-programmer I am to this field of SQL and relational processing :S )I am creating a temp table, doing an Bill of Material explosion for a single Order Line Item.(note: SQL Server 2000)I used blindman's "accumulator method (click here) (http://www.dbforums.com/showpost.php?p=6239109&postcount=6)" to generate the entire potential BOM tree.So; step 1 works wonderfully! :beer: Cheers blindman!Now; I want to remove unwanted nodes (and all their children) from the temp-table. I have a bunch of functions (0 to 1 for each node) that return a Yes or No. If "No", then flag-to-eliminate immediately that branch and don't revisit anything on it (and therein lies my problem). This will leave me with a temp table of only valid nodes.Since this is recursive, and since it will involve Dynamic SQL (the function name varies), all I can come up with is using a Cursor in a WHILE loop. Even at that; since a CURSOR is point-in-time (ie: values don't change once selected), I'll have to re-check the current temp table values (or create of 2nd temp table of only deleted nodes and repeat a SELECT with NOT EXISTS in it, hmmm).Since blindman's method generates a table ordered by level, the sequence of processing is pre-determined - unless I can re-order it into a more traditional hierarchy (1 entire branch at a time) and number the levels, in which case the cursor could just skip to the next branch of equal or higher level.Note: The thought does occur to me I could have an intermediary function (static name) that in turn does the Dynamic SQL. These functions contain the Business Logic that looks at a myriad of column values and relationships in the database and there's no one-size-fits-all decision tree so Dynamic SQL is necessary.The max cursor size will be maybe 300, and on average 100. Number of levels will normally be 3 or 4, but conceivably could be up to 10. Given the average 100 potential components/sub-assemblies, the final assembly will be about 30. As a periodic background process; it will do 3,000 Order Line Items a day, so I'm figuring 1 second response time per build is adequate (ie: the user's not waiting on it so it doesn't have to be blinding fast) - however why waste?Anyhow; I thought this might be a fun problem for some Data Structure genius who wants to give a lesson in Relational Programming.Thanks for looking.Here's what I have so far:CREATE PROCEDURE dbo.sp_ExplodeTest1 (@recID int = 1) AS/* tbTestH is a table containing an assembly hierarchy. Assemblies with no parent are Builds.Assemblies with no children are Components.It's columns: MyID int, ParentID int, (other descriptive columns)*/declare @t table (TempNodeID int identity(1,1),MyID int)-- Seed the tree with the Build's ID.insert into @t (MyID) values (@recID)/* This populates the temp table with the entire Assembly for the given build. It is Ordered By the level in the assembly. Number of assembly levels is infinite.For example: Level 1 = the Build. It comes firstLevel 2 = all parents are level 1. Is next (no particular seq)Level 3 = all parents are level 2. Is next (no particular seq)etc.*/while @@Rowcount > 0insert into @t (MyID)select tbTestH.MyID from tbTestHinner join @t rList on tbTestH.ParentID = rList.MyIDwhere not exists ( select *from @t CurrentList where CurrentList.MyID = tbTestH.MyID)-- now to display the results so far.select t.*, tbTestH.* from tbTestH inner join @t t on tbTestH.MyID = t.MyID order by t.TempNodeIDGO
View 8 Replies
View Related
Aug 9, 2007
What is included under SQL Data structures? Could anyone refer me to some good tutorials on that material?
View 2 Replies
View Related
Aug 23, 2006
I am using the wizard to create a new mining structure and getting the error at the time of selecting the datamining technique like either microsoft decision tree or microsoft timeseries etc.,
"Unable to retrieve a list of supported data mining algorithms. Make sure you are connected to the correct Analysis Services server instance and the Analysis Services server named localhost is running and configured properly. You can continue with a default list of data mining algorithms."
What is that means?
Thanks in advance,
View 3 Replies
View Related
Nov 15, 2000
I have a SQL 7 database with about 30 tables in. For documentation purposes I need to print out the structures of each table. I have tried using the diagram tools but no joy.
I have access to Access, Crystal Reports, if these are any use?
Please help!!
Tony Kavanagh
View 3 Replies
View Related
Jul 10, 2002
Hi,Does any of u folks used any tools for database structures comparision??
I have used DBDIFF(from DKGAS.com) ChangeManager from Embarcadaro and SQL COMPARE from Redgate.
I did have have some problem in each of these tools AND am looking for some good tools which are economical also.
Thx in advance
Ravi
View 2 Replies
View Related
Oct 5, 2001
A point for general discussion maybe.
I've just read Jeff's query regarding passing an array to a stored procedure, and it seems to be a question that hits the message board quite frequently. There often seems to be the case where you have some block of data in one location, and want to process it somewhere else, and there just isn't an easy way to do it (or is there?). Passing a cursor is possible, but getting data back out of a cursor is painful.
The ways I have used in the past are:
Using a cursor
Using a global temporary table
Using a "permanent" table, but declared with a unique name (using a timestamp) and passing the tablename as a parameter.
Has anybody any suggestions for a future SQL release which we could suggest to Microsoft?
Suggestions from myself:
-Having a single TSQL command to copy a cursor back into a table, to make cursor parameters less cumbersome
-Being able to pass a pointer to a temporary table as an SP parameter
-Allowing variables to be declared with more complex structures (such as arrays, or classes)
Regards,
ChrisH
View 1 Replies
View Related