Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 30th, 2004, 03:33 AM
Authorized User
 
Join Date: Dec 2004
Location: , , .
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

Reply With Quote
  #2 (permalink)  
Old December 30th, 2004, 06:51 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
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.
Reply With Quote
  #3 (permalink)  
Old December 30th, 2004, 08:30 AM
Authorized User
 
Join Date: Dec 2004
Location: , , .
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.

Reply With Quote
  #4 (permalink)  
Old December 30th, 2004, 11:19 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: Lehigh Acres, FL, USA.
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
Reply With Quote
  #5 (permalink)  
Old June 30th, 2006, 02:52 PM
Registered User
 
Join Date: Jun 2006
Location: , , USA.
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.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:20 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.