Find recent backup using SMO
Does anyone know how to find the most recent backup for a database using SMO? ...
Does anyone know how to find the most recent backup for a database using SMO? ...
Ok, I've scoured the web, BOL, various forums and I'm no closer to an answer...hopefully you fine folks can lend a hand... We've got a dozen or so SQL Servers (some 2k, some 2005) on a network. I'm using SMO objects in a .NET application to get some standard information. My problem appears to boil down to a missing DLL - Microsoft.SqlSe...
Folks, I'd like to create some T4 templates for generating class files (about 7 per table) from a database to support our in-house ORM (don't ask - long story and historical reasons.....) What I'd really love to do is have a property on my main TT template to visually pick server, database and table for which to create the files (somet...
I'm using C# with SMO and attempting to detect what edition of SQL Server (e.g., enterprise, standard) I'm connecting to. I know how to get the version information, but that only tells me what version of SQL Server (e.g., SQL Server 2008 vs SQL Server 2005). Does anyone know how to get the actual product edition (e.g., enterprise, stan...
Hi folks, I've got a web application that uses Microsoft Sql Management Objects (SMO) dll's. I'm wondering how I go about redistributing the libraries for a remote machine. As I understand it, these come with SQL server or Sql express - which isn't on the remote (shared) webserver. Asking the host to install them, is probably out of t...
Hi there, Can anyone let me know what is the best practice for doing sql server backups i.e. FULL, differential and partial differential I will doing this from code using SMO (c#) but anyway... is it best to do a FULL backup every 1 month and a differential every day?? Just looking for a bit of guidance really Any ideas? ...
I need to change some primary keys from non-clustered to clustered but I can't drop the constraint because it is referenced from other foreign keys. How can I find the tables that reference a primary key in the parent table as part of a foreign relation without looping through all tables in the DB? I need to disable the constraints on t...
I am using the TransferData method of the transfer class in SQL Server SMO. I have the call running on Windows XP, running SQL Server 2008 SP1, trying to transfer a table from SQL Server 2000 on another server to the XP machine. They both use the same SQL username and password. I have tested using the Import/Export Wizard and it ran fin...
I have SMO code which copies tables from one database to another. It runs fine in a desktop app. The same exact code put in a service, gives an error. The error is really obscure and doesn't hint about permissions. I was wondering if the SMO objects need any kind of security to be used. Security context? Windows credentials.. etc? I am ...
I have a project that creates a table from a DataTable to a SQL table via SMO. The datatypes of the columns do not convert currently from System.Type to SMO.DataType. I can do this via a Case statement but I was hoping for a cleaner solution. Maybe something involving TypeDescriptor.GetConverter(targetDataType). This works between Sys...
I am trying to look for a SQL table by name and if it exists drop it. This all needs to be done in C# using SMO. To complicate it a bit more the table also has a schema other then "dbo". Ultimatly the table will be recreated via SMO (I have this working) but I have to make sure it is not there before I can recreate it. All of the exam...
Hi I am trying to list all the instances of sqlserver using c++ in vs2005. How to do this using smo library in c++? give me code example. Thanks in advance.. ...
Hi Can any body plz tell me how to find the location where my data and log files stored using SMO in c# Thanks in Advance ...
Hi i have did like foreach(LogFile lf in db.Databases) Console.WriteLine(lf.FileName) which displays the logfile path including extension.....My Problem is how to find the Datafiles exact path including extension..Give me the Guidance Any Help is Greatly Appreciated... Thanks in Advance. ...
I am afraid that i am unable to locate the absolute path of the SQL SERVER data files. I have tried to so do by doing the following. foreach( Database db in srv.Databases) string filepath=db.PrimaryFilepath; string name=db.Name; abspth=filepath+"//"+name+".mdf"; Like this i have workaround.But is there is any alter...
Using the Microsoft.SqlServer.Management.Smo.Scripter object, I'm generating scripts for each of the tables in my database, including indexes/constraints. When it generates the script, however, it includes all the index options, even though they are the default values, e.g., CREATE TABLE [dbo].[AgeGroup]( [AgeGroupID] [int] NOT NUL...
I am trying to restore a database by first restoring a full backup and then restoring a differential backup by using the Microsoft.SqlServer.Management.Smo.Restore class. The full backup is restored with the following code: Restore myFullRestore = new Restore(); myFullRestore.Database = "DatabaseName"; myFullRestore.Action = RestoreActi...
Hi How to get enumfiles method in DMO in SMO means if i pass the master datafil;es to a method then it wil return the corresponding datafile path and logfile path. is there is any such method in SMO ?? for ex:in DMo Enumfiles(master) then it wil return corr filepath . is such method in SMO Plz Help me.. ...
Hi i wnat to display the Remote machine SQL instances using SMO .How to do this one. Suppose i am using the machine machine 1 from this machine i want to display the remote machine(ex machine2) SQL instances using smo how to this ?? i am using SmoApplication.EnumerateSqlServers(true) this dispalys only the local instances. false disp...
Hi How can i connect to the remote machine and getting the local instances using smo or any thing. using smo i did it for local instances but i dont know the same for remote instances how to do this. (My idea is connecting to the rmote computer and call the EnumAvailableSqlServers(true)) Can u give me ideas to do this??? Thanks in...