Get statement of a SQL object

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
 
S

Susie Johnson

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
 
E

e;o

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top