April 18, 2012

sp_ddopen (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
The meta data is from an SQL 2012 Server.

I have posted alot more, find the whole list here.

Goto Definition or MetaData

Definition:

sys.sp_ddopen(int @NameScope
, int @ODBCVer
, bit @fUsePattern
, nvarchar @procname
, nvarchar @p1
, nvarchar @p2
, nvarchar @p3
, nvarchar @p4
, nvarchar @p5
, nvarchar @p6
, int @p7)

MetaData:

   
create procedure sys.sp_ddopen;1
(
@handle int output,
@procname sysname,
@scrollopt int output,
@ccopt int output,
@rows int output,
@p1 nvarchar(774) = null,
@p2 nvarchar(774) = null,
@p3 nvarchar(774) = null,
@p4 nvarchar(774) = null,
@p5 nvarchar(774) = null,
@p6 nvarchar(774) = null,
@p7 int = null,
@NameScope int = 0,
@ODBCVer int = 2,
@fUsePattern bit = 1 -- To allow users to explicitly disable all pattern matching.
)
as
set nocount on
declare @ret int

--
-- Yukon clients are always going to send [sys].sp_name
--
if @procname = 'sp_column_privileges' or
@procname = '[sys].sp_column_privileges'
begin
exec @ret = sys.sp_ddopen;2 @handle output,
@scrollopt output,
@ccopt output,
@rows output,
@p1,
@p2,
@p3,
@p4
end
else if @procname = '[sys].sp_columns_100' or @procname = '[sys].sp_columns_90' or @procname = '[sys].sp_columns' or
@procname = '[sys].sp_columns_ex_100' or @procname = '[sys].sp_columns_ex_90' or @procname = '[sys].sp_columns_ex' or
@procname = 'sp_columns_90' or @procname = 'sp_columns' or
@procname = 'sp_columns_ex_90' or @procname = 'sp_columns_ex' or
@procname = '[sys].sp_table_type_columns_100' or
@procname = 'sp_table_type_columns_100'
begin
exec @ret = sys.sp_ddopen;3 @handle output,
@procname,
@scrollopt output,
@ccopt output,
@rows output,
@p1,
@p2,
@p3,
@p4,
@p5,
@NameScope,
@ODBCVer,
@fUsePattern
end
else if @procname = '[sys].sp_datatype_info_100' or @procname = '[sys].sp_datatype_info_90' or @procname = '[sys].sp_datatype_info' or
@procname = 'sp_datatype_info_90' or @procname = 'sp_datatype_info'
begin
exec @ret = sys.sp_ddopen;4 @handle output,
@procname,
@scrollopt output,
@ccopt output,
@rows output,
@p7,
@ODBCVer
end
else if @procname = 'sp_fkeys' or
@procname = '[sys].sp_fkeys'
begin
exec @ret = sys.sp_ddopen;5 @handle output,
@scrollopt output,
@ccopt output,
@rows output,
@p1,
@p2,
@p3,
@p4,
@p5,
@p6
end
else if @procname = 'sp_pkeys' or
@procname = '[sys].sp_pkeys'
begin
exec @ret = sys.sp_ddopen;6 @handle output,
@scrollopt output,
@ccopt output,
@rows output,
@p1,
@p2,
@p3
end
else if @procname = '[sys].sp_special_columns_100' or @procname = '[sys].sp_special_columns_90' or @procname = '[sys].sp_special_columns' or
@procname = 'sp_special_columns_90' or @procname = 'sp_special_columns'
begin
exec @ret = sys.sp_ddopen;7 @handle output,
@procname,
@scrollopt output,
@ccopt output,
@rows output,
@p1,
@p2,
@p3,
@p4,
@p5,
@p6,
@ODBCVer
end
else if @procname = '[sys].sp_sproc_columns_100' or @procname = '[sys].sp_sproc_columns_90' or @procname = '[sys].sp_sproc_columns' or
@procname = 'sp_sproc_columns_90' or @procname = 'sp_sproc_columns'
begin
exec @ret = sys.sp_ddopen;8 @handle output,
@procname,
@scrollopt output,
@ccopt output,
@rows output,
@p1,
@p2,
@p3,
@p4,
@ODBCVer,
@fUsePattern
end
else if @procname = '[sys].sp_statistics_100' or @procname = '[sys].sp_statistics' or
@procname = 'sp_statistics'
begin
exec @ret = sys.sp_ddopen;9 @handle output,
@scrollopt output,
@ccopt output,
@rows output,
@p1,
@p2,
@p3,
@p4,
@p5,
@p6
end
else if @procname = 'sp_stored_procedures' or
@procname = '[sys].sp_stored_procedures'
begin
exec @ret = sys.sp_ddopen;10 @handle output,
@scrollopt output,
@ccopt output,
@rows output,
@p1,
@p2,
@p3,
@fUsePattern
end
else if @procname = 'sp_table_privileges' or
@procname = '[sys].sp_table_privileges'
begin
exec @ret = sys.sp_ddopen;11 @handle output,
@scrollopt output,
@ccopt output,
@rows output,
@p1,
@p2,
@p3,
@fUsePattern
end
else if @procname = 'sp_tables' or @procname = 'sp_tables_ex' or
@procname = '[sys].sp_tables' or @procname = '[sys].sp_tables_ex'
begin
exec @ret = sys.sp_ddopen;12 @handle output,
@procname,
@scrollopt output,
@ccopt output,
@rows output,
@p1,
@p2,
@p3,
@p4,
@p5,
@fUsePattern
end
else if @procname = 'sp_tableswc' or
@procname = '[sys].sp_tableswc'
begin
exec @ret = sys.sp_ddopen;13 @handle output,
@procname,
@scrollopt output,
@ccopt output,
@rows output,
@p1,
@p2,
@p3,
@p4,
@fUsePattern
end
else
print 'Unknown sys.sp_ddopen procedure'
select @ret = isnull(@ret,0)
return isnull(@ret,0)

No comments:

Post a Comment

Total Pageviews