jwcolby
jwcolby at colbyconsulting.com
Sat Nov 21 11:40:33 CST 2009
Shamil, By get an instance of the Server object you can see a collection of Database objects. The following is what you can do with the database object. So I can manipulate a given database as shown below. Several of those things look potentially useful, such as running TSQL statements, truncating log files and so forth. http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.database.aspx However the database object has a tables collection. I can get lists of the names of tables, select a specific table etc. http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.table.aspx http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.table_methods.aspx The point is that it is just a programming model that is available if you want to learn it, for manipulating a database from C#. I will almost certainly never use 99.9% of it, just as most people (myself included) rarely use 99.9% of the DAO object model. OTOH the .1% that I do use is pretty darned cool. You can find a lot of little articles about using SMO out on Google. John W. Colby www.ColbyConsulting.com Shamil Salakhetdinov wrote: > Hi John -- > > OK, but why not just use connections strings and System.Data.SqlClient > classes, .... ? > > Thank you. > > -- > Shamil > > -----Original Message----- > From: dba-vb-bounces at databaseadvisors.com > [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby > Sent: Saturday, November 21, 2009 6:42 PM > To: Discussion concerning Visual Basic and related programming issues. > Subject: Re: [dba-VB] SMO was Projects vs Solutions > > > or do you plan to implement some custom applications using > Microsoft.SQLServer.* ? > > Exactly. My work for one of my clients is heavy manipulation of SQL Server. > I routinely export > files to an external application running on virtual machines on another > server, then wait for the > files to process, then import them back in to SQL server. These two > processes together take about > 10 stored procedures. The export / import has to occur on (currently) a > half dozen large databases > monthly. However as I obtain more lists that number goes up. Each process > exports to it's own > directory path, then imports back from a parallel directory path. While the > stored procedures > eliminate much of the manual labor, there is plenty left. Plus logging of > everything etc. > > I also routinely process orders. These orders take about a dozen stored > procedures and also use the > exact same set of stored procedures as the above process, i.e. the export / > import process is also > used on each and every order. > > So there is just a ton of very repetitive work that has to be done, but > which database / table > varies from run to run. To this point I have used Access / VBA to automate > these tasks. Now I am > moving to C# for this automation work. > > SMO allows me to manipulate SQL Server from C# and so it is an API that I > will use to assist me in > getting this program working. > > John W. Colby > www.ColbyConsulting.com > > > Shamil Salakhetdinov wrote: >> Hi John -- >> >> Yes, I understand that. >> I'm wondering what for do you learning this stuff? - Just out of curiosity >> or do you plan to implement some custom applications using >> Microsoft.SQLServer.* ? >> >> Thank you. >> >> -- >> Shamil >> >> -----Original Message----- >> From: dba-vb-bounces at databaseadvisors.com >> [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby >> Sent: Saturday, November 21, 2009 5:06 AM >> To: Discussion concerning Visual Basic and related programming issues. >> Subject: Re: [dba-VB] SMO was Projects vs Solutions >> >> That is used for manipulating the SMO object and SQL Server. >> >> I am just learning this stuff and do what the demos tell me to do. >> >> John W. Colby >> www.ColbyConsulting.com > > > > > __________ Information from ESET NOD32 Antivirus, version of virus signature > database 4626 (20091120) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.esetnod32.ru > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > >