• Hi,

    Does the Assembly and stored procs have to be installed in each database, you wish to call the stored proc from? The example works fine, when:

    SET @sqlcmd ='Select * from sys.objects'

    SET @filename = 'c:\object_export.txt'

    EXECUTE master.[dbo].[WriteResultsToCsvFile]

    @sqlcmd

    ,@filename

    However the information returned is from the Master database and not the database I do the call from.

    Equally if I change @sqlcmd to

    SET @sqlcmd ='Select * from thisdb.dbo.atable'

    SET @filename = 'c:\object_export.txt'

    EXECUTE master.[dbo].[WriteResultsToCsvFile]

    @sqlcmd

    ,@filename

    I do not get any output.

    I must be missing the obvious, please enlighten me.

    Thanks