Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sp_ddopen - What is this doing?

Captured this in SQL Profiler, being sent from a 3rd party app. What is it doing?

declare @p1 int
set @p1=180150003
declare @p3 int
set @p3=8
declare @p4 int
set @p4=1
declare @p5 int
set @p5=34
exec sp_ddopen @p1 output,N'sp_sproc_columns',@p3 output,@p4 output,@p5 output,N'some_stored_procedure_name',NULL,NULL,NULL
select @p1, @p3, @p4, @p5

edit: my best guess: Its an ODBC driver asking for the parameters that a stored procedure needs.
Here's the source code for sp_ddopen, apparently.

edit2: the setting of the @p parameters before the exec is an artifact of the Sql Profiler apparently. In its original form, the sp_ddopen would have been called with all parameters being null, and they would have returned the values shown.

like image 812
codeulike Avatar asked Oct 26 '11 13:10

codeulike


2 Answers

According to MS (see http://msdn.microsoft.com/en-us/library/ms187961.aspx) this is an internal stored procedure which is NOT officially documented... it operates on the internal DB catalog (metadata for DB objects) and is used for example by the SQL Server ODBC driver when you/some app calls SQLTables or SQLTablesW (see for example http://support.microsoft.com/kb/315761/en-us).

Thus I would think that your guess is right :-)

like image 196
Yahia Avatar answered Oct 22 '22 05:10

Yahia


From sp_helptext sp_ddopen it looks like a version translation layer between an API like ODBC/OLEDB for a variety of system stored procs.

If your case I'd guess the application is version-independently calling sp_sproc_columns to sniff the prototype of some_stored_procedure_name.

like image 26
Alex K. Avatar answered Oct 22 '22 04:10

Alex K.