Dude, You'll need to delve in the world of S.M.O. to achieve what you want to do in C# Search for SMO articles or example code. Late a, Good luck on the search. I know you'll find a lot of stuff.
AL On Sun, Nov 16, 2008 at 2:34 AM, I~N~S~I <[EMAIL PROTECTED]> wrote: > > Thnkx for ur reply. > i understand that its taking a lot of time. But i this is not my > requirement. > I need to create the Create table statements on the fly (within the > application it self). At present i have hard coded the create table > statements into the Code. But i need to generate the create table > statement dynamically. > for e.g. if i need a method say if i pass the Database name and table > name to it. it will return the create table statement for the passed > table as a String. then i can execute this inside my code and create > the new table in another database. > also note my databases do not have any Stored Procedures. But it does > have constraints. Also at present i haven't created any indexes i plan > to introduce them later. > > again thnk you for ur reply. > > On Nov 15, 9:06 pm, "Stephen Russell" <[EMAIL PROTECTED]> wrote: > > Dude, you have to give the SQL engine something to work with for the > install > > right? This is a large text file that is passed to the server and > executed. > > > > One part of your distribution process is to make a new Database script. > It > > may take all of 2 min time to generate this unless you have hundreds of > SPs > > and Views then it may take 3 min. > > > > You could break the script into parts. DB, Tables and Indexes. Then > SPs, > > views and UDFs. Now submit the parts instead of the whole for creation. > > > > ………………………………………………………………… > > Stephen Russell – > > Senior Visual Studio Developer, DBA > > > > Memphis, TN > > 901.246-0159 > > > > -----Original Message----- > > From: [email protected] > > > > [mailto:[EMAIL PROTECTED] On Behalf Of I~N~S~I > > Sent: Saturday, November 15, 2008 7:40 AM > > To: DotNetDevelopment, VB.NET <http://vb.net/>, C# .NET, > > ADO.NET<http://ado.net/>, > ASP.NET <http://asp.net/>, XML, XML Web > > Services,.NET Remoting > > Subject: [DotNetDevelopment] Re: Creating Databases using another > database > > as a template > > > > thanks for ur reply. but i need to create this from my Application it > > self. I'm using C# .Net i dont want to change my code which creates > > the database each time i do a change the structure of the Base > > Database. > > > > On Nov 15, 6:30 pm, "Stephen Russell" <[EMAIL PROTECTED]> wrote: > > > From SSMS you can Rt Click on a database, Generate Scripts. > > > > > This brings up a wizard that you tell which dbs to script out and to > what > > > level you would like. It will allow you to define all or any SP, View, > > > Table, User, Schema etc. > > > > > Real fast and easy to use. > > > > > ......................... > > > Stephen Russell - > > > Senior Visual Studio Developer, DBA > > > > > Memphis, TN > > > 901.246-0159 > > > > > -----Original Message----- > > > From: [email protected] > > > > > [mailto:[EMAIL PROTECTED] On Behalf Of I~N~S~I > > > Sent: Friday, November 14, 2008 10:45 PM > > > To: DotNetDevelopment, VB.NET <http://vb.net/>, C# .NET, > > > ADO.NET<http://ado.net/>, > ASP.NET <http://asp.net/>, XML, XML Web > > > Services,.NET Remoting > > > Subject: [DotNetDevelopment] Creating Databases using another database > as > > a > > > template > > > > > I have a requirement which is to create a application which is able to > > > create databases based on another database. i need to copy only the > > > table structures no need to copy the data. > > > > > At present im just creating SQL command objects with the comment text > > > containing the the create table statements (which i had to hard code > > > into the code) and use the ExecuteNonQuery() and execute. > > > This becomes very painful when i do sme structure modification to the > > > database (base database) as now i have to edit the database creation > > > part. > > > > > I found one method of doing it using 'SQL Server Management Objects' > > > which generate the create table statements. but im not sure whether i > > > can use it becos im running the application in machine which do not > > > have a sql server installed (they connect to the sql server through > > > LAN). So i cannot add the reference as most of the machines will be > > > having only the .Net framework installed. > > > if anyones interested refer below link for more details on this > > > method.http://davidhayden.com/blog/dave/archive/2006/02/09/2795.aspx > > > > > Is there another way of archiving this? > > > > > thanks in advance > > > > > No virus found in this incoming message. > > > Checked by AVG -http://www.avg.com > > > Version: 8.0.175 / Virus Database: 270.9.3/1786 - Release Date: > 11/14/2008 > > > 8:32 AM > > > > No virus found in this incoming message. > > Checked by AVG -http://www.avg.com > > Version: 8.0.175 / Virus Database: 270.9.3/1786 - Release Date: > 11/14/2008 > > 8:32 AM >
