Get statement of a SQL object

  • Thread starter Thread starter skibum365
  • Start date Start date
S

skibum365

I am developing a routine that needs to grab the SQL statement for
each database object in the current project (ie the SQL statement for
each stored procedure, view, and function).

This is a sample of how I'm iterating through the objects in VBA:

Private Sub MyProcedure()

....

For Each v1 In Application.CurrentData.AllViews
MySub v1.Name
'Need code here to get SQL statement of v1
strSQL = ??????????
MyOtherSub strSQL
Next

For Each sp1 In Application.CurrentData.AllStoredProcedures
CalculateDependancies sp1.Name
'Need code here to get SQL statement of sp1
strSQL = ??????????
MyOtherSub strSQL
Next

For Each func In Application.CurrentData.AllFunctions
CalculateDependancies func.Name
'Need code here to get SQL statement of func
strSQL = ??????????
MyOtherSub strSQL
Next

....

End Sub



Does anyone know of a SQL Server system stored procedure or VBA object
that I can use to retrieve the SQL statement for a database object?

Thanks,
Paul
 
for the record; I have helped this person-- and Microsoft removed my posting

WHY?

BECAUSE MICROSOFT ENGAGES IN FUD BECAUSE THEY ARE TOO LAZY TO FIX BUGS
 
I am developing a routine that needs to grab the SQL statement for
each database object in the current project (ie the SQL statement for
each stored procedure, view, and function).

This is a sample of how I'm iterating through the objects in VBA:

Private Sub MyProcedure()

....

For Each v1 In Application.CurrentData.AllViews
MySub v1.Name
'Need code here to get SQL statement of v1
strSQL = ??????????
MyOtherSub strSQL
Next

For Each sp1 In Application.CurrentData.AllStoredProcedures
CalculateDependancies sp1.Name
'Need code here to get SQL statement of sp1
strSQL = ??????????
MyOtherSub strSQL
Next

For Each func In Application.CurrentData.AllFunctions
CalculateDependancies func.Name
'Need code here to get SQL statement of func
strSQL = ??????????
MyOtherSub strSQL
Next

....

End Sub



Does anyone know of a SQL Server system stored procedure or VBA object
that I can use to retrieve the SQL statement for a database object?

Thanks,
Paul
 
Back
Top