Questions tagged [smo]

0 votes
0 replies
SSIS call to SMO works in Visual Studio but fails when run from a SQL Agent Job on the server. Jobs not using SMO work fine
I wrote an SSIS 2017 package that uses SMO (sql server management ojects) to synch my disaster recovery (DR) server with my production server. B...
asked 4 months ago
0 votes
1 replies
How to ALTER…CHECK CHECK CONSTRAINT using PowerShell and SMO
I have a PowerShell script that checks if the Constraint is enabled and checked. I want to add a step to do the equivalent of "ALTER.....CHECK CH...
asked 5 months ago
0 votes
0 replies
Assigning an existing SQL login to a newly created database using c#
I am developing an application in which I am creating a database and deploying a few tables using c# and SMO. I am able to create the database a...
asked 5 months ago
0 votes
2 replies
Where can I find a SQL Server Management Objects Collection for SQL Server Express?
I have written an application that works fine when run from Visual Studio 2017, and uses the following libraries: Microsoft.SqlServer.Manageme...
asked 6 months ago
0 votes
0 replies
How to fix Dac Deployment error “InternalDeploymentPlanModifier could not be instantiated”
I try to deploy a .dacpac package programmatically using this code: var dacServices = new DacServices(myConnectionString);...
asked 5 months ago
0 votes
0 replies
SQL Server database restore with CDC using SQL Management Objects in C#
I am restoring a full database backup from our production server to our staging server using the Restore class in SQL Management Objects, via a C...
asked 7 months ago
0 votes
0 replies
Failed to create SQL script transfer with powershell
I've got next error when I'm trying to create database script: Exception calling "EnumScriptTransfer" with "0" argument(s): "Script transfe...
asked 7 months ago
1 votes
0 replies
Type 'System.Web.HttpContextWrapper' in Assembly 'System.Web' is not marked as serializable
I am trying to execute some queries using Microsoft.SqlServer.Management.Smo.Server in my web application. But it throws the following exception:...
asked 7 months ago
0 votes
1 replies
SMO library on Delphi
I'm using SQL Server 2017. Is there any way to use the SMO library in Delphi (FMX)? The official documentation shows how to use this library fro...
asked 8 months ago
0 votes
0 replies
Attach SQL Database from Local server directory using SMO
I am looking a workaround to attach MDF File from the server local directory(c:\data) using SMO in C#.net. it works fine when we attach the datab...
asked 9 months ago
0 votes
1 replies
How to restore multiple transaction logs using SMO for .NET
I am working on a database application to restore a database with its transaction logs. I am using the SQL Server Management Objects (SMO) Librar...
asked 9 months ago
1 votes
1 replies
How to find equal, modified, and unique SQL objects from multiple servers/databases?
Problem Summary: We have a set of databases on multiple servers that "should" all have the same SQL objects. Over the years, our developers have...
asked 5 months ago
0 votes
0 replies
Why Invoke-SqlCmd works, but Ado.Net does not against a database in the Restoring state?
Here is the Ado.Net code (written in Powershell): function ExecuteSqlQuery( [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()]...
asked 6 months ago
0 votes
0 replies
Get error messages yet continue execution in SMO
I'm working on rewriting the app we use to run upgrades on our database. Basically the idea of the app is it takes a bunch of scripts (one for ea...
asked 7 months ago
0 votes
1 replies
SMO generate database script using PowerShell, so it was same way as when creating script manually from Management Studio
I need to generate script in code using SMO so it was totally same as if I'm creating it manually using Management Studio. I.e. Database -> Ta...
asked 6 months ago
0 votes
2 replies
c# SMO Backup - how to use ExpirationDate?
I followed roughly this example to backup a database with Microsofts SMO API and the code crashed with an exception telling invalid parameter Exp...
asked 8 months ago
2 votes
0 replies
SMO alternative for Oracle
We use SMO (SQL Server Management Objects) in .Net code for programming all aspects of a Microsoft SQL Server database. Do we have any similar li...
asked 7 months ago
0 votes
1 replies
SQL Server table with different case in PowerShell SMO vs SSMS
I'm quite confused and not sure where to start looking. I have a tablename that appears in different case sys.object and in the SSMS GUI, as oppo...
asked 9 months ago
0 votes
1 replies
SMO - How to script an object in a Dynamic SQL style? (IF NOT EXISTS)
When I use SMO to script a procedure with the IncludeIfNotExists set to true, it first creates the procedure and then alters it. Is there a way f...
asked 3 months ago
0 votes
0 replies
SMO Database scripting USE DATABASE statement
I am trying to get database scripts generated by using PowerShell with SMO. I am generating all in to one .sql file. I seem to be able to get eve...
asked 3 months ago
42 votes
10 replies
Reference Microsoft.SqlServer.Smo.dll
I need to use Server class which is stored in Microsoft.SqlServer.Smo.dll I don't see this assembly in usual References dialog. I have found it a...
asked 8 years ago
4 votes
3 replies
Get length of Columns using SQL Server Management Objects (SMO)
I'm writing T4 templates to generate CRUD stored procs etc I am looping through the columns of a table using SMO: For Each column As Column In...
asked 9 years ago
4 votes
1 replies
C# & SQL Server : ExecuteNonQuery returning -1, when UPDATE works?
Apologies if this has been asked before. I have searched for an hour and not found the exact problem I am having. I am using SMO to run some que...
asked 1 year ago
14 votes
7 replies
Could not load file or assembly microsoft.sqlserver.sqlclrprovider 13.100.0.0
I run my Winforms app using SQLServer assemblies Microsoft.SqlServer.ConnectionInfo (13.100.0.0) Microsoft.SqlServer.SMO(13.100.0.0) On the same...
asked 3 years ago
4 votes
2 replies
Backup fails using smo on big databases
I use vb.net to backup sql '05 - '08 databases. It works great on smaller databases. but when it comes to large databases it fails at 30 or 40 pe...
asked 8 years ago