Copying Data And Structure From One Database To Another
Jul 23, 2005
Hi all!
I have an application that needs to copy the database structure from
one database to another without using the "Generate SQL Script"
function in Enterprise Manager. I'd like to do this from within a
stored procedure. Can someone recommend the best approach for this?
I've seen references to using SQL-DMO from a stored procedure using the
sp_OA* procs in other postings to this group but was wondering if there
was an easier way? Can I use bcp and then use xp_cmdshell from within
my stored procedure? It's not clear to me from the documentation
whether bcp copies both structure and data or just data? Is there a
better way?
Thanks in advance for any help!
Karen
View 1 Replies
ADVERTISEMENT
Jan 25, 2008
Hi all,
Is there a way to copy a structure of one database (tables and fields) to another database WITHOUT copying the data??
Someway to do that with replication??
any help is very appreciated!
Thank you,
View 4 Replies
View Related
Mar 31, 2007
I is possible to copy the structure of an existing SQL 2000 table to make a new table with Visual Studio 2005?
View 2 Replies
View Related
Jan 25, 2007
Yet another very much newbie question I suspect€¦.
I want to know how I copy data from one field in one
DataBase to another field in another DataBase??
Basically I have an ASP driven forum, and want to upgrade to
a new ASP.NET forum€¦ Problem is obviously the DataBase structure is different
and I don€™t want to loose all the data from my current forum€¦ So I would have to pick which table field
needs to be copied to where in the new DataBase..
Is this easy to do??
I will be using SQLExpress 2005??
Thanks
View 1 Replies
View Related
Mar 19, 2008
I have written 5 content-management systems and am getting a little bored writing a lot of the same functionality and tweaking it for different datamodels. Is there a way within .NET to have visibility of a database's structure (ie, data type, column names, foreign keys etc)? I'd like to write up a dynamically generated form for any given table, displaying appropriate form controls based on data type and foreign keys.
View 7 Replies
View Related
Feb 19, 2007
I have been working on my windows app, using SQL Server 2005 (& C#) but I now have loads of junk data, so I want to copy the structure without any data to a new set of files that can become the production version.
I assume I can use backup and restore in future when I want a copy of my production data to use for future testing.
How would I take just one table from my test database and add it to my production database without retyping the design?
Apart from the size limitation is there any advantage in buying a version of SQL Server over using the Express edition?
View 1 Replies
View Related
Feb 13, 2008
I'm looking to create a new version of a database but with completely reloaded data - so I want to retain the database structure but none of the data.
Is there an easy way (read: without a DBA on staff) to copy an existing database structure - preferably with views and stored procedures - and not take the data along for the ride?
Thanks in advance for suggestions...!
View 7 Replies
View Related
Oct 25, 2005
hi all
i have two databases on two different machines.
both databses r having same names.
i want to copy data from the table in other database to table in databse on my machine .
how can i do this.
i will be very thankful to receive help.
View 2 Replies
View Related
Sep 7, 2006
Hi. I need to move data from one database table to
another across database instances. A simple example of the typical
move would be:
[CODE]
INSERT into destination_db.dbo.table1
SELECT column1, column2, column3, column4 from source_db.dbo.table2
[/CODE]
My options are:
1. Create an SSIS package to perform the move.
2. Create sprocs and schedule the data move as jobs.
3. Write .NET code using sprocs to perform the move.
I'll have to move hundreds of thousands of records, so I want the
option that provides the best performance. I'm guessing that option 3
will be the slowest.
Thanks for the help!
View 4 Replies
View Related
Jul 23, 2005
Is there a way to copy the structure from one database to anotherwithout affecting the actual data?For example, I added new fields and stored procedures to a db in mydevelopment environment. There are a lot of them.I now want to make the same changes to my production environment db butdon't want to affect the data. Only the fields, stored procs &constraints and stuff pertaining to the structure of the db should bechanged.Does anyone know of a program that can do this or can this be done inMS SQL Enterprise Manager.Any help would be appreciated.7078895
View 2 Replies
View Related
Dec 2, 2005
... and preserving the relationships.(Note, this is more of a SQL question than a SQL-related ASP.NET question...)Say I have two databases, D1 and D2, with the same three tables:CompaniesDepartmentsEmployeesWith the standard one-to-many relationships down the line, with eachtable having a PK, IDENTITY field like CompanyID, DepartmentID, andEmployeeID.I have a smattering of data in each of D1 and D2 for these tables withoverlaps in the ID field values. What I want to be able to do is copyover D1's data to D2, preserving the relationships in D1 even thoughthere are ID overlaps in D2. So the tool I'd use would have to besmart enough to check for ID dups in D2 and appropriate change the IDvalues in D1's tables, maintaining the relationships.Is there some built-in SQL tool to do this or do I have to do this myself?Thanks!
View 5 Replies
View Related
Mar 9, 2007
I need to copy data from TableA to TableB (>5 millions rows). The two are in the same database.
What is the best way of doing this?
I was thinking about using a simple INSERT INTO ... SELECT statement. Is there a faster way to do it with SSIS?
Thanks
View 13 Replies
View Related
Oct 15, 2006
Is it possible to purge all records in the database while retaining the the table structures. Even better yet, could I do it on a table by table basis? If I simply delete all the records the identities for the tables do not revert back to 1.
View 2 Replies
View Related
May 16, 2007
Does anyone know how to copying database objects and data from Oracle 8 to SQL 2005 ?
View 1 Replies
View Related
Jul 26, 2006
When copying data to a remote SQL2K5 destination from a SQL2K5 source database, both using mixed sql server security mode, my job generates the following error:
[Transfer SQL Server Objects Task] Error: Execution failed with the following error: "Cannot apply value null to property Login: Value cannot be null..".
This occurs after the destination database tables have been truncated and replacement data from the source would begin to copy.
The same process can be successfully completed from the Management studio with a simple data export process. However, when I run the saved package again from the BI interface, I get this error.
My search engine searches have yielded numerous hits of others having the same problem with one microsoft rep indicating it was a bug and would be resolved in sp1. I am working with sp1. Oddly, there is only mention of this in the forums. No KB article from MS addresses the problem and I do not see it addressed elsewhere at sqlservercentral.
It appears that others have switched to Integrated Security and resolved the problem. However, I do not have that option with a remotely hosted database.
Does anyone have any information concerning this problem?
View 1 Replies
View Related
Dec 26, 2007
I represent a software development house and we have developed a client server system based on SQL Server. Most of our customers have already purchased Enterprise License of SQL Server, therefore they own the SA Login and Password. We are bound to attach our Database with their Server on their machine.
My question is how can we stop a System Administrator of SQL Server to view our Database Structure, Queries, Data installed on their SQL Server on their machine.
Our database structure is a trade secret and we cant reveal the structure to the client.
please answer this question by email to me at farhandotcom@gmail.com
Thanks & Regards
Farhan
View 1 Replies
View Related
Jun 20, 2008
1) I can't get the 'copy database' function to work from SQL Server 2008 to SQL Server 2005. I connect ok. Everything goes to the last step and then it fails.2) I cant get a SQL server 2008 backup to restore on SQL SEerver 2005 either.
The only way I know that works is to script the creation of all tables then export and import. This does work.
How can I get the 'entire' database, structure and data, from 2008 to 2005?
ThanksSQL newbie.
View 2 Replies
View Related
Jan 2, 2008
I have "inherited" a project working on a SQL 2000 database. The project calculates commissions based on data from an invoice header table and an invoice details table. The goal is to extract data from the primary database tables, perform limited manipulations, and store the resultant data into a table in a different database for reference and reporting. I have the query complete that extracts and manipulates the data, but I am stuck in trying to add this data to the final storage/reporting table. I would also like to do error checking to be certain that a record is not "re-inserted" from the source data to the destination table. Thanks in advance, Barry
View 3 Replies
View Related
Feb 24, 2006
Hello everyone,I have a webcontrol that uses database-structures alot, it uses the system tables in SQL to read column information from tables. To ease the load of the SQL server I have a property that stores this information in a cache and everything works fine.I am doing some research to find if there are anyway to get information from the SQL server that the structure from a table has changed.I want to know if a column or table has changed any values, like datatype, name, properties, etc.Any suggestions out there ?!
View 3 Replies
View Related
Jan 6, 2008
Hi,
I have a complicated sql server mobile database (.sdf) and need to create a SQL SERVER database with the same tables. How can I do it without scripting the whole thing? I thought of using the views.information_schema databases, but it is still a lot of coding.
thanks
View 3 Replies
View Related
Mar 9, 2000
How to maintain Database User Permissions when copying the Database from One SQL Server to another(Either through backups or sp_detach). The reason is the login sid is different in the target server and as a result the database user is not able to map to the login existing in the target server. The only way I can correct this is through dropping and recreating the user's again and assign the permissions, or change the system catalog - sysusers to remap the login to the user in the database.
I do not wish to use the sp_addalias as it is available only for backward compatibility.
Is there a better way of doing this ?
View 4 Replies
View Related
Nov 14, 2007
I Have a problem when copying data from one server to another in Management studio, I need to create and exact copy of the original because of primary key relationships,
Currently when I export the data the data will run through an insert type statement, which means that all PKs are reissued, rather than being duplicated from the original, How can I be sure that the data will be copied exactly how it is on one server to the other.
View 4 Replies
View Related
Jan 2, 2008
i've created a package that will copy data from an oracle table to a sqlserv table (that table elemenst are identical), when i click on the connecting line between the two connections it executes without any errors, but nothing is copied, when i try to execute the package i'm getting an error... where can i go to find out what's causing the error. There is no error message or number returned from dts, all i get is a red 'x' . There are 1236 records that need to be inserted and when i get the red 'x' it tells me 1236 records have been processed. When i click on tranformations and select test, it works, but since it's a test nothing is actually copied. I've got other packages that i've created that do the same thing with other tables and they work. I tried just copying one record and that worked, so i assumed it must be data dependent, i've checked all the fields and made sure they weren't null, i've checked to make sure there aren't duplicate primary key records. Without knowing what the actual error is I'm stumped ???
View 4 Replies
View Related
Sep 25, 2007
Hello I am a final year student and for my final year project I have decided to try and create a price comparison website due to the fact that i feel it would be a good project to work on and develop my technical skills in C# and microsoft sql server 2005, since these are mainly the two programs I would say i have more experience with. Basically I want to create a website such as www.pricerunner.com. At this point in time i have started playing around with how i feel the database will look, in terms of tables and columns, below is what i have produced;
Company
Company_ID
Company_name
ADDRESS
Website link
contact
Products
Product_ID
Product_name
Product_Category
Product_Price
I am now stuck as how i will link each company with a product bearing in mind a company will stock different categories of products, also do you think i need any more columns in any of the above tables, as well as am i missing out on anything, I am hoping someone with more knowlegde than myself can shed some knowledge on my problem, thank you.
View 5 Replies
View Related
Aug 10, 2005
I'm sure there is a simple way to do this but I cannot think of it.I have an ASP.NET application that I am publishing to a webhost. I have chosen to use FTP to copy my files (aspx, etc.). They work as far as links etc. Now, the next step is to create my SQL database on their server as they instruct, which I have done in name only. (Oh, if it makes a difference, I access the hosting service using Plesk control panel.) Is there any simple way to get my database structure from my PC to the host server? All responses welcome. Thanks.
View 5 Replies
View Related
Oct 9, 2001
Hi All,
I need to get some info on how I can get the script of the entire database stucture. I need to write a procedure to do this. I know in SQL Server I could get the script in a mouse click. But I need to write a procedure to do the task. Is there a package in SQL Server that I could use to accomplish this task?
Any thoughts will be of help.
Thanks in advance.
sj
View 1 Replies
View Related
Sep 2, 1999
I am very new to SQL server, and am completely stumped here. I need to transfer the data from an old database to a new one (both SQL Server 6.5 DBs.) The only problem is that the database has been restructured, and I can't for the life of me figure out how to get the data imported. I am working on manually making all of the structure changes, but there must be a better way. Any ideas? Thank you SO much!
Jeff
View 1 Replies
View Related
Nov 1, 2004
This is a sort of database structure question that could I guess apply to any type of database...
Say I have 4 production lines and I want to log serial numbers on the start of every line and off the end of every line.
Is there any advantage in having a separate table for each Production Line and serial number logging point? (i.e. t_Line1Start, t_Line1End, t_Line2Start etc) or is it just the same as having one big table and having a LineNumber field and a StartEnd field?
Is SQL Server just as happy dealing with fewer transactions to several tables as it is to many transactions to one table?
View 1 Replies
View Related
Apr 9, 2008
Hi,
I have a question. I want to build a db for the following entities:
drivers
cars
companies
each driver nay has a car (NULL or carId)
each driver belongs to company
each car belongs to company
The db structure I built is:
car(carId, companyId)
driver(driverId, companyId, carId)
company(companyId)
The problem is that in this structure driver from company a can have a car from company b.
but this situation is not possible.. How can I prevent such situation??
tnx
View 14 Replies
View Related
Jul 8, 2006
Is there a way I can copy my SQL 2000 database including procedures, views tec. the whole works but not the data in any table.
I want to share with a relative a copy of my application (web based) he has his own SQL 2000 server but I do not want to give my data just the database so the application will run and he can start inputting his own data.
How can I do this like a backup which has everything but with no data.
I tried scripting it using the EM but it did not give me everything just the system db's
Thanks
Xavier
View 3 Replies
View Related
Jan 11, 2008
I'm designing a web application that acts as business management software for many small autobody shops. This method was chosen because it creates a central point of administration for the software and I believe that a properly configured cluster of services will meet performance requirements. Using SQL Server 2k5 as my backend, I need to structure my DB(s) so that performance and size are kept to a minimum.
That being said, the first problem I encounter is in creating a structure that supports multiple businesses, each with their own unique dataset.
For example, each business will have work orders specific to their business. This necessitates a uniqueness constrained by businessID (hereafter titled "BizID") and WorkOrderID (WoID). The first solution I happened on was the simplest: A composite primary key composed of BizID (int) and WoID (int). The unfortunate consequence of this, as I soon realized, was that *every* table containing multiple business' data would need this composite key structure. The second problem with this method is that there is no such thing (to my knowledge) as a composite identity. I could identify WoID as the identity column, but it would not iterate WoID for BizID x properly if any other Biz added a work order to the table. (i.e. biz 1 adds three work orders (identitied 1, 2, 3), biz 2 adds one work order (would identity as 4) and Biz 1 adds another (would identity as 5), leaving us with 1, 2, 3, 4, 5 across two businesses, rather than 1, 2, 3, 4 for biz 1 and 1 for Biz 2)
The second idea I considered was one DB per business. I didn't consider that for very long, since I assumed size considerations would be blown out of the water if I had 50 business and 50 DBs. I could be wrong, as I am decidedly a novice at this. It does benefit from not putting all my eggs in one basket though and makes backup/recovery/troubleshooting much simpler.
The third idea I considered was one table per business. This suffers from the same issues as #2 above with not as many of the benefits.
Both ideas 2 and 3 would need a master table relating logins to the DBs they belong to, which would not be hard to implement at all, but the implications of using this method are unknown to me.
So quite obviously, I'm a novice at this. Perhaps I took a project on that was too big for my britches, but just getting out of college puts me in a good place to take a risk and I will learn a great deal from putting a complex (is it so?) system like this into action.
I appreciate any and all responses, thanks in advance for your replies!
-Devin
View 5 Replies
View Related
May 5, 2008
I am trying to copy one database to another using copy wizard for SQL Server 2005. The destination database is on another server/box.
I get the following errors when executing the SSIS package: "The job failed. The Job was invoked by User abcd. The last step to run was step 1 (abcd_0_Step).".
"Executed as user: BILLSVRSYSTEM. ...ion 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 11:30:55 AM Progress: 2008-05-05 11:30:56.81 Source: crmtest_BILLSVR_Transfer Objects Task Task just started the execution.: 0% complete End Progress Error: 2008-05-05 11:30:57.34 Code: 0x00000000 Source: abcd_abcd_Transfer Objects Task Description: Failed to connect to server crmtest. StackTrace: at Microsoft.SqlServer.Management.Common.ConnectionManager.Connect() at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.OpenConnection(Server& server, ServerProperty serverProp) InnerException-->Login failed for user 'abcdabcd$'. StackTrace: at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.... The package execution fa... The step failed."
Can this be done? Is there something that needs to be set security wise for this to work?
View 9 Replies
View Related