sql server - Executing remote procedure with user-defined table type variable parameter -
i'm trying call remote stored procedure on linked server. problem is, 1 of required parameters user-defined table types.
i can't seem figure out how declare local variable user-defined table type remote server.
this i'm trying far, doesn't work:
declare @tblvar [remoteserver].remotedb.dbo.user_defined_table_type exec [remoteserver].remotedb.dbo.procedure_name (@param1 = @tblvar)
however error i'm getting is:
the type name 'remoteserver.remotedb.dbo' contains more maximum number of prefixes. maximum 1.
must declare scalar variable "@tblvar"
upon further research discovered table variables invalid remote procedure calls.
instead, did called exec [remoteserver].[remotedb]..sp_executesql
, declared , populated table variable , called stored procedure inside of that.
example:
declare @sql nvarchar(4000) set @sql = n' declare @tblvar dbo.user_defined_table_type -- code populate table here exec dbo.procedure_name (@param1 = @tblvar) ' exec [remoteserver].[remotedb]..sp_executesql @stmt = @sql
and solved problem. else out in future.
Comments
Post a Comment