Showing posts with label configure. Show all posts
Showing posts with label configure. Show all posts

Monday, March 19, 2012

How can you enable remote connections using TSQL?

I know how to enable remote connections using the Surface Area Configuration tool.
Seems there would also be a way to configure it using a TSQL command/procedure call.
thanks,
- Paul -
You can use sp_configure to enable the features exposed by Surface Area Configuration tool. To see the options, run following first:
exec sp_configure 'show advanced options', 1;
reconfigure with override;
Please take a look at topic below in Books Online for more details.
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/scsql9/html/f741169c-1453-4ad2-830b-bf2be27d712f.htm
For remote connections, you have to use SMO to do it. Doing it from TSQL directly is not possible since it requires manipulation of registry values and please don't use the undocumented XPs for registry manipulation.

Friday, February 24, 2012

How can I use several resultsets from stored procedure?

I have create stored procedure that returns 2 resultsets. When I configure OLE DB Source to use this procedure I can not add second output for he source. I get following error:

TITLE: Microsoft Visual Studio

Error at Data Flow Task [OLE DB Source [1]]: An output cannot be added to the outputs collection.


ADDITIONAL INFORMATION:

Exception from HRESULT: 0xC020800F (Microsoft.SqlServer.DTSPipelineWrap)


BUTTONS:

OK

How to add second output?

The stock OLEDB source component supports one non-error output.

To populate multiple outputs from a source component (perhaps to avoid a double extract), you can write a script source transform with as many outputs as necessary. Building multi output transforms (script and custom) is not much more difficult than a single output source component.

Furthermore, you can write a custom source tranform if you wish to re-use the code (aka toolbox resident) more easily than cut/paste re-use of script components.

If a little coding is not up your alley, then you're stuck with a single output.

Of course there are probably workarounds to simulate two outputs, such as interleaving/marking the columns of the two result sets such that they form one result set you can later conditionally split, but that is likely beside the point.