Reference Microsoft.SqlServer.Smo.dll

C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies is the correct folder location (or C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies on 64-bit systems). You need to add references to: Microsoft.SqlServer.ConnectionInfo.dll Microsoft.SqlServer.Smo.dll Microsoft.SqlServer.Management.Sdk.Sfc.dll Microsoft.SqlServer.SqlEnum.dll (These are the minimum files that are required to build an SMO application) For SQL Server 2016, this location is C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies (for the … Read more

Programmatically retrieve SQL Server stored procedure source that is identical to the source returned by the SQL Server Management Studio gui?

EXEC sp_helptext ‘your procedure name’; This avoids the problem with INFORMATION_SCHEMA approach wherein the stored procedure gets cut off if it is too long. Update: David writes that this isn’t identical to his sproc…perhaps because it returns the lines as ‘records’ to preserve formatting? If you want to see the results in a more ‘natural’ … Read more

tech