Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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 April 4th, 2009, 04:34 PM
Authorized User
 
Join Date: Mar 2009
Posts: 75
Thanks: 16
Thanked 1 Time in 1 Post
Default Exporting/Importig stored procedures

How can i copy stored procedures that in database in the source code, and paste them into my database?
 
Old April 4th, 2009, 06:07 PM
Friend of Wrox
Points: 546, Level: 8
Points: 546, Level: 8 Points: 546, Level: 8 Points: 546, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2009
Posts: 105
Thanks: 3
Thanked 20 Times in 19 Posts
Default

If the stored procedure exists in one database (tbh) and you want to copy it to your database it is quite simple. If you are using SQL Server Management Studio you can script it out by right-clicking on the stored procedure and selecting the Script and create method.

If you are using Visual Studio you can use the Server Explorer and double click on the stored procedure to open it in the VS IDE, where you can then copy and paste somewhere to run as a sql script. Note however that the script will start with the Alter keyword that you will need to change to the Create keyword before running it against your other database.

You can uses SSMS to create scripts for multiple stored procedures, put them all in one text file, separated by go statements and run the entire set of scripts at one time.


Steve
 
Old April 5th, 2009, 05:01 AM
Authorized User
 
Join Date: Mar 2009
Posts: 75
Thanks: 16
Thanked 1 Time in 1 Post
Default

I've opened source code database in SSMS, and created a script off all needed stored procedures in 1 file.
Now how do I run this script in visual studio over my project's database?
 
Old April 5th, 2009, 01:51 PM
Friend of Wrox
Points: 546, Level: 8
Points: 546, Level: 8 Points: 546, Level: 8 Points: 546, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2009
Posts: 105
Thanks: 3
Thanked 20 Times in 19 Posts
Default

Yevi,

You won't be able to run your script in Visual Studio. You will need to attach your new database to SQL Server using SSMS, select the database and open a new query window. Then paste the script into the query window and run it; alternately, after you attach your new database you could drag and drop your sql script (provided it has a .sql extension) onto the SSMS query window area and it will create/open a new query window with the script in it, then you just need to ensure that your database is selected in the drop down before running the script.

Visual studio is set up to only deal with one table or stored procdure at a time, and then not via scripts.


Steve
The Following User Says Thank You to Steve S For This Useful Post:
yevi (April 6th, 2009)
 
Old April 6th, 2009, 03:57 AM
Authorized User
 
Join Date: Mar 2009
Posts: 75
Thanks: 16
Thanked 1 Time in 1 Post
Default

Thanks, done!





Similar Threads
Thread Thread Starter Forum Replies Last Post
stored procedures MunishBhatia SQL Server 2005 4 April 12th, 2008 01:39 AM
STORED PROCEDURES shazia1 SQL Server ASP 7 September 26th, 2007 06:11 AM
Stored Procedures itHighway SQL Server 2000 3 November 23rd, 2005 10:08 AM
Using Stored Procedures lintacious Classic ASP Basics 1 August 12th, 2003 04:06 PM





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