Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 30th, 2004, 03:33 AM
Authorized User
 
Join Date: Dec 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Coping stored procedure

Hello to all experts out there

How do I copy stored proceudres and table structures from one database to another using SQL. :)

Not need to use DTS

 
Old December 30th, 2004, 06:51 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

You can generate SQL of your entire database through Enterprise Manager.

1) Open Enterprise Mgr.

2) Locate database

3) Right click. Open All Tasks -> generate SQL script

4) In the window, select the objects you wish to include in the SQL

5) generate

6) Then through query analyzer, select the new database.

7) Open the abopve SQL with the new database and run.
 
Old December 30th, 2004, 08:30 AM
Authorized User
 
Join Date: Dec 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi madhukp
Actually I have done the same thing sucessfully but just wondering any other way.
also giving a thought on coping only the structure of tables from one db to another.

 
Old December 30th, 2004, 11:19 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

I used this from a fellow co-worker see if it will be of any use to you
If the table name(s) is(are) going to be variable, you will need to use dynamic SQL. For example:

Code:
CREATE PROCEDURE whatever
    @newTable VARCHAR(40),
    @oldTable VARCHAR(40)
AS
EXEC('SELECT * INTO ' + @newTable + ' FROM ' + @oldTable + ' WHERE 1 = 0')
EXEC('ALTER TABLE ' + @newTable ' ADD newColumn newDataType, ...')
Jaime E. Maccou
 
Old June 30th, 2006, 02:52 PM
Registered User
 
Join Date: Jun 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I create a sql server dts job, and now I want to copy it to a diferent server registration how do you do this.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Stored Procedure Help BukovanJ SQL Language 2 October 10th, 2006 08:02 AM
stored procedure keyvanjan Classic ASP Basics 2 May 26th, 2006 01:16 AM
Stored Procedure rajanikrishna SQL Server 2000 0 July 18th, 2005 05:01 AM
Help About Stored Procedure zhuge6 BOOK: ASP.NET Website Programming Problem-Design-Solution 3 May 20th, 2005 09:27 AM
stored procedure allang MySQL 3 January 26th, 2005 12:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.