Aracılığıyla paylaş


AuditSpecification.Script Yöntemi

Oluşturduğu bir Transact-SQL komut dosyası yeniden için kullanılabilirdenetim belirtimi.

Ad Alanı:  Microsoft.SqlServer.Management.Smo
Derleme:  Microsoft.SqlServer.Smo (Microsoft.SqlServer.Smo içinde.dll)

Sözdizimi

'Bildirim
Public Function Script As StringCollection
'Kullanım
Dim instance As AuditSpecification
Dim returnValue As StringCollection

returnValue = instance.Script()
public StringCollection Script()
public:
virtual StringCollection^ Script() sealed
abstract Script : unit -> StringCollection 
override Script : unit -> StringCollection 
public final function Script() : StringCollection

Dönüş Değeri

Tür: System.Collections.Specialized.StringCollection
A StringCollection listesini içeren sistem nesnesi değeri Transact-SQL Query deyimler

Uygulamalar

IScriptable.Script()

Açıklamalar

Script yöntem oluşturur bir küme , Transact-SQL yarat veritabanı için kullanılan ifadelerBu yöntem sadece veritabanı oluşturmak için kullanılan bir komut dosyası oluşturur.Tablolar gibi bağımlı nesneler dahil olmak üzere tüm veritabanını önererek nesnesini kullanarak komut dosyası.

Bu üretilmiş komut dosyası, tam komut dosyası çıktısı için gereken belgelenmemiş, iç yordamlar içerebilir.

Örnekler

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Reference the AdventureWorks2008R2 database.
Dim db As Database
db = srv.Databases("AdventureWorks2008R2")
'Define a Scripter object and set the required scripting options.
Dim scrp As Scripter
scrp = New Scripter(srv)
scrp.Options.ScriptDrops = False
scrp.Options.WithDependencies = True
'Iterate through the tables in database and script each one. Display the script.
'Note that the StringCollection type needs the System.Collections.Specialized namespace to be included.
Dim tb As Table
Dim smoObjects(1) As Urn
For Each tb In db.Tables
    smoObjects = New Urn(0) {}
    smoObjects(0) = tb.Urn
    If tb.IsSystemObject = False Then
        Dim sc As StringCollection
        sc = scrp.Script(smoObjects)
        Dim st As String
        For Each st In sc
            Console.WriteLine(st)
        Next
    End If
Next