• sorry Scott,

    but your code threw error 134 so I just tried to fix it.

    But you put me on the right lane. The solution looks like this:

    DECLARE @SQLstmtAs nvarchar(500)= NULL

    DECLARE @CountRowsAS int = 0

    SET @SQLstmt =

    N'SELECT @Count = Count (*) ' +

    ' FROM [' + @rowDSServer+ ']' + '.'

    + '[' + @rowDSDatenbank+ ']' + '.'

    + '[' + @strDSTabelleQual+ ']' + '.'

    + '[' + @strDSTabelle+ ']' +

    ' WHERE [DRUCKER] = ''' + @ParPRINTER_NAME_LEN8 + '''' + ';'

    EXEC sys.sp_executesql @stmt = @SQLstmt

    , @params = N'@Count int OUTPUT'

    , @Count = @CountRows OUTPUT

    -- This SELECT statement returns the value of the OUTPUT parameter.

    SELECT @CountRows

    IF @CountRows > 0

    BEGIN

    .

    .

    END

    ALL I needed was the output parameter. The other parameters like @rowDSServer etc. are simply filled long before I get here.:-)

    thx

    --
    candide
    ________Panta rhei