Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 16th, 2004, 03:22 PM
Lmod Lmod is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 105 Lmod User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 22 m 3 sec
Reputation Power: 6
Generate SQL

Hi. My host cut off all connectivity to MS SQL server via E nterprise Manager, Web Matrix etc. Because of mis use by some of their customers. And They provided a web based db admin title ASP.Net Enterprise Manager for us to use. This program is fine but I need the functionality of MS EM. So I installed MSDE on my workstation to develop and I am going to upload to the server after testing my apps. Now I was wondering if there is a way to generate SQL (like the generate sql function is MS EM) in a SQL statement so that I can replicate my already create db tables in MSDE to build my testing model easily. Or am I just stuck re-creating everything in MSDE again. Also is there a better version of a web based MS SQL db manager out there with compariable functionality as MS EM. Thanks

Reply With Quote
  #2  
Old August 16th, 2004, 03:23 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,776 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 27 m 42 sec
Reputation Power: 470
You would have to write the SQL Statements using DDL.

Reply With Quote
  #3  
Old August 16th, 2004, 03:30 PM
Lmod Lmod is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 105 Lmod User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 22 m 3 sec
Reputation Power: 6
I understand that if you mean to re-create the tables in my MSDE development db. But how does that apply to generating the Create Table script for my already existing db tables. I am probably missing somthing. Please explain further

Reply With Quote
  #4  
Old August 16th, 2004, 03:52 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,776 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 27 m 42 sec
Reputation Power: 470
Are you wanting to create new objects, such as tables, etc.. through a script that is executed against a database?

Reply With Quote
  #5  
Old August 16th, 2004, 04:00 PM
Lmod Lmod is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 105 Lmod User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 22 m 3 sec
Reputation Power: 6
Quote:
Originally Posted by Memnoch
Are you wanting to create new objects, such as tables, etc.. through a script that is executed against a database?

Here is the scenario. I have a db created it has a total of 8 tables I am still adding to this db because I am still developing apps. What I want to do is generate the sql for my existing db so I can copy and paste it in Query Analizer to easily re-create my existing in the MSDE development db I am going to use on my workstation. This way I can still design triggers, and maintain the keys and constraints via the db diagram (which are things I cannot do with ASP.NET enterprise manager). Since I cant connect to my db via Enterprise Manager on my workstation I lose the ability to create triggers, diagrams etc. So now I have to develop in my environment and the upload to the server. I hope this explains the situation.

Last edited by Lmod : August 16th, 2004 at 04:05 PM. Reason: More Information

Reply With Quote
  #6  
Old August 16th, 2004, 04:32 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,776 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 27 m 42 sec
Reputation Power: 470
You would have to script out all of the new objects, then write an ASP page that will read those scripts and execute them against the database.

Reply With Quote
  #7  
Old August 16th, 2004, 04:48 PM
Lmod Lmod is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 105 Lmod User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 22 m 3 sec
Reputation Power: 6
There is no way to write a script that will do the same job as Enterprise Managers "Generate SQL Script" function?

Reply With Quote
  #8  
Old August 16th, 2004, 05:58 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,776 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 27 m 42 sec
Reputation Power: 470
You can write the script yourself.
Code:
CREATE PROCEDURE stp_MyStoredProcedure
   @prmName
AS
SELECT *
FROM TableName
WHERE Username = @prmName

You would save this to a file (.txt or .sql or whatever).
Then just open the database connection, create an instance of the FileSystemObject, read the file, save the contents to a variable, then execute the variable against the database connection.

Reply With Quote
  #9  
Old August 16th, 2004, 06:04 PM
Lmod Lmod is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 105 Lmod User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 22 m 3 sec
Reputation Power: 6
Thanks Memnoch I will give it a try

Reply With Quote
  #10  
Old August 16th, 2004, 07:28 PM
Lmod Lmod is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 105 Lmod User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 22 m 3 sec
Reputation Power: 6
Memnoch as I am trying to get this sp to work I started wondering is this example you gave me to extract the data from my existing db, or to generate the create table, SQL, PK, FK, Constraints etc?

Reply With Quote
  #11  
Old August 16th, 2004, 09:38 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,776 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 27 m 42 sec
Reputation Power: 470
It's just a sample Stored Procedure that would be created within the database.

Reply With Quote
  #12  
Old September 13th, 2004, 09:36 PM
TomDNaughton TomDNaughton is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 TomDNaughton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Scripting tool

My company has a product that scripts SQL objects, compares two versions of a SQL databases and scripts the changes, generates insert and update statements based on table structure, and more. I created it after growing frustrated with EM as a tool to script changes I may have made over time.

You can try it for free and own it for just $79 if you like it.

www.revaware.com/sqladp


Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Generate SQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |