Duplicating Db Structure Without Data

Oct 28, 2004

i have a database on one server that I want to duplicate on a new server. I do not want to copy the data only the structure.





I created some SQL scripts from the current db as I have read that is what I should do.





My question is where do I use this script on my new server to create the new tables etc..





Do i use the import feature. Where do I run my sql script?








thanks

View 2 Replies


ADVERTISEMENT

Stored Proc Duplicating Data

Aug 15, 2006

Hi all, I have a stored proc which returns twice the result and I dontknow why. Can someone have a look at the following code?BTW, I commented the last SELECT/JOIN, cause that one doubled theresult too.CREATE procedure ent_tasks_per_user_company (@companyName as varchar(50),@resourceName as varchar(50))ASSELECTtasks.WPROJ_ID as WPROJ_ID, tasks.ENT_ProjectUniqueID asProjectUniqueID, tasks.ENT_TaskUniqueID as TaskUniqueID,tasks.TaskEnterpriseOutlineCode1ID as TaskEnterpriseOutlineCode1ID,codes.OC_NAME as OC_NAME, codes.OC_DESCRIPTION as OC_DESCRIPTION,codes.OC_CACHED_FULL_NAME as OC_CACHED_FULL_NAME,taskStd.TaskName as TaskName, taskStd.TaskResourceNames asTaskResourceNames, taskStd.TaskPercentComplete as TaskPercentCompleteINTO #myTempFROM MSP_VIEW_PROJ_TASKS_ENT as tasksINNER JOIN MSP_OUTLINE_CODES as codesON(codes.CODE_UID = tasks.TaskEnterpriseOutlineCode1IDANDcodes.OC_CACHED_FULL_NAME LIKE @companyName + '.%')INNER JOIN MSP_VIEW_PROJ_TASKS_STD as taskStdON(taskStd.WPROJ_ID = tasks.WPROJ_IDANDtaskStd.TaskUniqueID = tasks.ENT_TaskUniqueID--AND--taskStd.TaskResourceNames LIKE '%' + @resourceName + '%')WHERE (tasks.TaskEnterpriseOutlineCode1ID <-1)/*SELECT #myTemp.*, taskCode.OC_NAME as Department FROM #myTempINNER JOIN MSP_OUTLINE_CODES taskCodeON(taskCode.CODE_UID = #myTemp.TaskEnterpriseOutlineCode1ID)*/SELECT * FROM #myTemp WHERE #myTemp.TaskResourceNames LIKE '%' +@resourceName + '%'Thank you!Chris

View 3 Replies View Related

Automatically Duplicating Table Data In 2 Databases

Jun 3, 2015

I am very well versed on manipulating data using passthrough queries through access or the command object in ADO/VBA but this problem requires a sql server side solution and I have been assigned the task

Scenario

Access via an ODBC link cannot view Sql table data that uses a BigInt as a primary key. Access can update the data, insert data ands delete data to these tables - but viewing (by design) returns the actual count of the rows but each field is populated with #deleted.

I can view the table data if I use a passtyhrough query but performing row level and field level edits from there is impossible. Not all people have Studio manager so that is not an option.

We are moving away from our legacy application and the development company has already developed the schema using the BigInt so changing that to a numeric or integer is out of the question. My boss has determined that using a set of bridge tables with identical tables in a different database where we replace the bigint with int will work - we can view the data in the "bridged" database and even update it from select queries and simply by opening the table in view mode from Access.

Here is the hard part (for me) because I have never done this. I can write SQL and understand the security/roles etc, but I have never administered SQL server regarding server side triggers and stored procedures - I have always used the command object or passthrough queries to deal with sql stored procedures. I need to either

A)Create some trigger behind the tables in my bridge table that will fire a stored procedure to replicate the data to the bigint database. They are both on the same sever.

B)Somehow create a "mirror" that always replicates from my bridge database tables (5 of them) to the new database.

View 3 Replies View Related

T-SQL (SS2K8) :: How To Introduce New Select / Join From Another Table Without Duplicating Original Data

Feb 19, 2015

I built a query that brings in 'Discounts' (bolded) to the Order detail by using the bolded syntax below. I started off by running the query without the bolded lines and got exactly what I was looking for but without the ‘Discount’ column. When I tried to add the ‘Discount’ into the query, it duplicated several order lines. Although total ‘Discount’ column ties out to the total amount expected in that column, ‘Total Charges’ are now several times higher than before.

For example, I get 75 records when I run without the bolded syntax and I get several hundred results back when adding back in the bolded syntax when i should still be getting 75 records, just with an additional column ‘PTL Discount’ subtotaled.My question is, how to I introduce a new select or join from another table without duplicating the original data?

select
first_stop.actual_departure ‘Start'
, last_stop.actual_departure 'End'
, last_stop.city_name 'End city'
, last_stop.state 'End state'
, last_stop.zip_code 'End zip'

[code]....

View 9 Replies View Related

Duplicating A Database

Dec 2, 2004

Hi

What i am trying to do is duplicate a database on my server without the data contained within it. Is there a way to do this and if so, how?

Thanks

View 12 Replies View Related

Duplicating Databases

Feb 12, 2004

Ok. Here is what I need to do. I don't even know if it is possible. I have a production server and a db backup server. In a perfect world, I want to be able to place a copy of my databases (users and all) on the backup server and have it update (all changes) regularly.

I messed with DTS but it errors out because I don't have user accounts set up on the backup server. (I'm not entirely sure it does anything I want to do anyway)

Can anyone help me find a clue?
!dbnewb!

View 3 Replies View Related

Duplicating A Database In SQL 2005

Mar 14, 2008

I like the script table to.... function is sql server 2005, but I was wondering if there was a way to do this for the entire database.Like if I want to create the database and all the tables inside it without having to copy each individual table's code. Know how to do this? Thankee. 

View 5 Replies View Related

Choices For Duplicating Database

Aug 22, 2006

I am developing an application that uses SQL Server 2000 for the back end. I am at the stage where some modules in the app can be tested while I finish development on some others. I run my own tests against SQL Server running on my own PC but for other people to test I have set up another server with SQL Server 2000 and have restored my database there.

My question is as follows:
I would like any changes to my database (structure and data) to be replicated on the test server's database (not necessarily immediately, but without much delay). I've heard the buzz words (log shipping, replication, etc) but would like some advice on the best way to proceed.
At the moment I don't need any data back from the test server and I don't particularly care if test data on that server is lost although these may become issues later on.

View 9 Replies View Related

Duplicating Permissions Of A Database Role

Jan 20, 2004

thanks for reading.

i would like to create a new database role that has exactly the same permissions as an existing database role. the combinations of permissions are complicated enough to make this a time consuming task worthy of a script of some sort. any suggestions?

i'm running SQL Server 2000 and can't find anything about copying roles unless it's through DTS from one DB to another. not sure if this is applicable to basically duplicating and renaming a role in one database.

in case you're wondering why anyone would want to do this you may not be surprised to know that it's a government thing. some policy about differentiating between 2 roles -- even though they currently have exactly the same permissions, the similarities might change in the future.

thanks in advance for your input.

View 1 Replies View Related

Data Structure -- It's Been A While

Jul 20, 2005

Ok, I haven't been doing too much database work lately and my brain has gonesoft.I need some help with proper structure.My database is being used to track television shows.Any given show will be associated with at least one production company (callit ProdCo) but possibly up to 3 production companies (never more than that).I have:tblNetworkNetID (numeric, Identity)NetName (char, 50)tblShowDataBookingNum (numeric, Identity)BookingNumExt (numeric, Identity)Now, if I was just dealing with one ProdCo I would add it tblShowData as aforeign key from tblNetwork; no problem.How do I structure it so that I can combine 1 to 3 ProdCo's as one referencein tblShowData.I tried:tblNetworkComboID (numeric, Identity)Net1Net2Net3The problem is, obviously I can only join the FK from tblNetworks to one ofthe NetX fields in tblNetworkCombo.I don't quite know where to go from here. Any help would be appreciated.

View 3 Replies View Related

Duplicating Rows Based On A Integer Column

Dec 17, 2007

I have a table that holds a number of offers made to a orginization for placements at a lecture. what im wanting to do is have each of the rows for a orginization repeated so that the names of people attending can be put into the database.

The first table would looks something like this:

id___|__orginization_| lecture | offers
1 | orga | lec1 | 5
2 | orgb | lec1 | 3
3 | orga | lec2 | 3


the result im looking to get is something like this where the name of the attendess would be inputed in an application.
id | orginization | lecture | nameofattende
1 | orga | lec1 | j. blog
2 | orga | lec1 | s. smith
3 | orga | lec1 | h. samual
4 | orga | lec1 | j. sams
5 | orga | lec1 | b.j. james
6 | orgb | lec1 | m. curry
7 | orgb | lec1 | k. murry
8 | orgb | lec1 | g. hansen



Can anyone help with this

cheers

colin

View 4 Replies View Related

Replicating Structure As Well As Data

Dec 27, 1999

Are there any known problems with replicating structure changes (New table, etc...), as well as data in MSSQL Server 7.0?

View 2 Replies View Related

Exporting Data+Structure

Mar 4, 2004

Hello E'body,

I have to export a SQL Server Table (Structure+Data) to an access mdb file at run time. How can i do it? please help.

Lax.

View 1 Replies View Related

Can't Change Data Structure

Nov 14, 2014

I have a database (MSSQL). To demonstrate the problem let me show a fictive Tablestructure. I don't want to discuss about how to save the data differntly, because the structure is fix and I can't change it.To get this result I would do a sql query with a lot of joins like that:

SELECT firstname, lastname, email.value, phone.value
FROM Customer
INNER JOIN
(
SELECT Customer_Properties.id, Customer_Properties.value
FROM Customer_Properties

[code]...

I don't think that this is really performant and the SQL-Queries get very complicated. Give it a other methode for that? I can't change the data structure.

View 3 Replies View Related

DATA STRUCTURE MIGRATION

Apr 23, 2008

Hi
Can Any one help me out of this in my project I have to migrate only datastructure or schema and not the data inside the table using SSIS. How can I do that ?

View 9 Replies View Related

Replicating Structure Only Not Data

Dec 1, 2006

I have a SQL 2005 database that I am using with a website. This basic website will be sold to other companies and ran on their servers with different URLs. Since, All of these databases will store different data, I'm not sure how I can make updates to original database and replicate those structure changes to the other DBs without changing the data also. Is there a way to automate the replication of structural DB changes without replicating the data along with it?

Thanks,

Kirk

View 5 Replies View Related

Getting Id Values From Both Source And Target Rows When Duplicating Records

Aug 27, 2007

Hi, I am copying records in a table. The source table and the target table are the same. I need the value from the id-field from both the source and target row. Is there a way to do this with one query?

I tried the following, but it doesn't seem to work:

INSERT tableOne (value1, value2, value3)
OUTPUT source.id, inserted.id
SELECT value1, value2, value3 FROM tableOne AS source
WHERE ID = @number

View 2 Replies View Related

Copy Table Structure Only - Not Data

Oct 18, 2007

We have SQL Enterprise Manager (8.0).  Is there any way to Copy a Table from one database to another with only the Structure (design) - not all the Data? 
I can't find any option in the Import Data Wizard that only copies the Table structure.
 Any help is appreciated.  Thanks
 

View 1 Replies View Related

Accessing Data Structure Of A MS SQL Database

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

Question On Data/structure Restore

Sep 20, 2006

new to SQL Server 2000. We have an obsolete database that we need to
save off for x number of years. DB2 has utilities (DB2Look/Export)
that allows for the export of the data along with a schema and script
that enables the future recreation of the structure of the databases
and tables to include RI etc. You can save off the architecture and
relationships of the tables as well as the data.

Does SQL Server have anything similar?

Failing that, our plan is to backup the data and logs then image the entire disk.

Thanks in advance.

Gerry

View 8 Replies View Related

Changing The Structure Of Data In A Table

Feb 20, 2004

I have a table that looks like this:

ID Type
123 Phone
123 Meeting
123 Phone


and I would like the data to look like this

ID phone Meeting
123 2 1


How do I do this?

View 3 Replies View Related

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 fromone database to another without using the "Generate SQL Script"function in Enterprise Manager. I'd like to do this from within astored procedure. Can someone recommend the best approach for this?I've seen references to using SQL-DMO from a stored procedure using thesp_OA* procs in other postings to this group but was wondering if therewas an easier way? Can I use bcp and then use xp_cmdshell from withinmy stored procedure? It's not clear to me from the documentationwhether bcp copies both structure and data or just data? Is there abetter way?Thanks in advance for any help!Karen

View 1 Replies View Related

Performance And Data Structure Question

Feb 2, 2006

Hi SQL gurus,I have a table structure question. I will have a table 'Models' thathas one to many 'incomes' and one to many 'costs'. These 2 entitieshave exactly the same structure, which is 7 smallmoney and a name. Isit better to create a table 'Incomes' and a table 'Costs', with boththe same number of fields like this :Incomes-------------in_idmodelin_1in_2in_3in_4in_5in_6in_7in_nameCosts-------------c_idmodelc_1c_2c_3c_4c_5c_6c_7c_nameor is it better to create one single table that will contain bothentities like that :Incomes_Costs-------------ic_idmodelic_1ic_2ic_3ic_4ic_5ic_6ic_7ic_nameic_isIncomewhich only differs from the 2 above by the isIncome field to know whichrow is an income and which row is a cost.I'd like to know which method is the best in terms of performance andgeneral structure and would greatly appreciate if you explain a littlethe reasons that drove you to suggest me a method over the other.Thanks all for your time!ibiza

View 4 Replies View Related

Large Export Of Data From One DB Of One Structure To Another

Aug 31, 2006

Hi guys,

Hopefully this is the right place to ask.

Basically we have have two larges databases, one of which is updated from the other monthly.

For exaplination purposes:

DB1 = Source DB

DB2 = Destination DB

The problem that I require a soltion to is, how do I insert rows from a table in DB1 to DB2 and recover and store the identity of the new row against the ID of the existing row. This is so that I can then matain constraints when it comes to inserting rows into the next table and the next and so on.

This process of storing the ID's as lookups will need to be done for almost every table of which there are 20.

The best Idea we have at the minute is to create a table with two colums for each table (drop it and recreate it after each table has exported) that contains the two ID's, new and old.

This will require using a cursor for each row in the existing table, inserting it in the new table and the using @@Scope_Identity to get the new ID and then insert the two values into the temp table.

This too me feels like it will be very slow, particuarly when I bear in mind how much data we have.

Does anyone have any better ideas? (Sorry if the explaination isn't great, its difficult to get accross)

Thanks

Ed

View 1 Replies View Related

Copy Just The Database Structure Not The Data

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

Copy Database Structure But Not The Data

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

OSQL Unicode Insert Of ^F (Hex 06) From Registry Multi-String Value Is Duplicating In DB

Jul 26, 2005

I'm using a Unicode sql script imported using OSQL. One of the valueswe are attempting to insert is a Registry Multi-String value by passinga string to a stored procedure. These Multi-String values appear to bedelimited by a Hex 06 (^F) character. When I import this character,embedded in a string preceeded by an N, i.eN'somethingsomething2something3'I end up with TWO of this character in the db. I get :somethingsomething2something3Any help figuring out why or how to fix this? We MUST use Unicode dueto extended character sets, so NOT using Unicode is NOT a solution.

View 1 Replies View Related

Moving Data To A Table With A Different Field Structure

Sep 25, 2003

In order to export data to a 3rd party provider, I build five separate tables to store the data. Every table has a different layout, except for the first four columns. They are record type, SSN, employee id and another id number.

Basically, I have to sort that data by SSN then by record type. Each employee will have multiple records.

However, that data will need to be "merged" into one table to be exported.

I have created a table that defines the first four columns, but then has one large "filler" field that will contain the rest of the data. How can I copy data from five different tables with five different layouts into one table?

Any suggestions?

Thanks,
Steve Hanzelman

View 6 Replies View Related

Automating Validation Of Structure / Data Of CSV File

Feb 15, 2013

We have the following scenario: We receive CSV files every month for which SSIS packages were built to process the data. The following problems occur from time to time:

1. The structure of the CSV file changed (e.g. column added or removed)
2. There were no footers in the data, but now footers started to appear
3. Date format changed (e.g. used to be mm/dd/yyyy, but became mm.dd.yyyy)
4. Number format changed (e.g. from 2000 to 2,000)

Currently we have person who manually opens each file, and using our "validation document" validates to ensure none of these or similar problems occur. We would like to move away from this manual process if possible. I understand that items 3. and 4. could be caught by loading data into a staging table with VARCHAR data types, and performing validation before moving it any further.

Item 2 is a bit questionable (meaning depending on the footer size SSIS load could fail or not).

Item 1, however, is a sure fail of the SSIS package that directly loads the data into a table.

Thus I feel the two possible options are:

1. Create a custom script that will run through the file, row by row, apply all the necessary validations and report an error or continue if all checks out

2. Use some 3rd party tool to validate the files (semi-manually) before kicking off the SSIS processing.

View 3 Replies View Related

Exporting Structure && Data To Access Table

Mar 11, 2004

Hello E'body

I have an application with MSAccess as front end and SQLServer as backend. have quite a bit of tables. i wanted to write a stored procedure which exports a SQL Server table (both Structure & Data) to a new Access MDB file. i know with the use of DTS its possible but i need to code it down. i need to perform this at runtime. so can anybody help.
Its urgent.

Bye.

Lax

View 1 Replies View Related

How To Copy Database Structure From One Db To Another W/o Affecting Data

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

Data Warehousing :: Use New Table With Reduced Structure?

Aug 24, 2015

I have a large fact table spread across tens of partitions (appx. 1TB each). I found that the business does not need much of the columns in the table. So, as an optimization action, I decided to get rid of these un-needed columns.What is the efficient way to achieve this? Can I simply drop these columns from the table, or use a new table with the reduced structure?

View 2 Replies View Related

Purging A Database Data While Keeping The Structure Intact

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







Copyrights 2005-15 www.BigResource.com, All rights reserved