Questions tagged [sql-smo]

5 questions
6
votes
1 answer

SQL SMO not enumerating tables

I feel like a dork just for asking this, but I'm not getting any help from Google, and I paged through all of SO's results on a simple search for SMO and didn't see it either. The short version is that I'm starting to play around with T4. I'm…
John Rudy
  • 37,282
  • 14
  • 64
  • 100
2
votes
2 answers

How can I identify only base tables when iterating through all tables in SQL smo?

This is my code: Server server = new Server(new ServerConnection(con)); server.ConnectionContext.Connect(); foreach (Table table in server.Databases[sqlDatabase].Tables) { if (table ) Basically this pulls back views as well I…
NibblyPig
  • 51,118
  • 72
  • 200
  • 356
0
votes
1 answer

How to subscribe to Database attach/detach events?

I am writing a C# application which works with databases and creates a new database on monthly basis. The older databases can be detached and attached by a user through SQL Management studio or other ways. I am trying to figure out how to listen to…
user1651105
  • 1,727
  • 4
  • 25
  • 45
0
votes
1 answer

Impersonating user account fails in SQL 2016 SMO

I am running a Windows WCF service using local system account and from within the service we are trying to connect to SQL Server instance using SMO with domain user account. The code shown below works fine is I am using SMO from SQL Server 2014 SDK,…
Ashish Mittal
  • 643
  • 3
  • 12
  • 32
0
votes
2 answers

SQL Comparing two Stored procedures between databases

I have two version of same database and need to campare some objects between them (stored procedures, views etc.) Actually ?m using SQLDMO-SQLSMO to retrieve the Text of each object then I perform a text comparison. This is efective but take a long…
Juan Pablo Gomez
  • 5,203
  • 11
  • 55
  • 101