Home Forums SQL Server 7,2000 T-SQL Find Affected Row Count from a Dynamic Query RE: Find Affected Row Count from a Dynamic Query

  • Hello Friends,

    I know this is an old topic but related to my issue.

    I have a similiar requirement. How do I suppress the output of this sp_executesql.?

    if we run the below sql statments, we get all the data relating to sysobjects.

    DECLARE @sSQL NVARCHAR(100), @rowcount INT

    SET @sSQL = 'select * from sysobjects'

    EXEC sp_executesql @sSQL

    SELECT @rowcount = @@ROWCOUNT

    PRINT '@rowcount = ' + CAST(@rowcount AS VARCHAR(4))

    but I am just interested in knowing only whether the select query is valid or not. I tried parseonly but the sql statments which I am running is inside a stored procedure (a sqlserver stored procedure cannot use parseonly command).

    Help

    Abhi