Home Forums SQL Server 2008 T-SQL (SS2K8) how to replace this cursor with set based solution? RE: how to replace this cursor with set based solution?

  • well, then I had to comment out WITH SCHEMABINDING, because try as I might, to do what the message wanted, it was still same error.

    If you can show me how to use proper naming convention, as in point out where exactly problem is, I would appreciate.

    See, I have added the schema dbo...

    CREATE FUNCTION GetBench (@bench varchar(20))

    RETURNS TABLE

    --WITH SCHEMABINDING

    AS RETURN

    SELECT r.createdate

    FROM Sandbox.dbo.Runs r

    INNER JOIN Sandbox.dbo.runs_machines rm ON rm.runid = r.runid

    INNER JOIN Sandbox.dbo.Machines m ON m.machineid = rm.machineid

    WHERE m.NAME LIKE (@bench + '[0-9][0-9][0-9]')

    AND r.createdate > dateadd(M, - 3, getdate());

    ps. I recall now that schemabinding ensures that you can't modify underlyling tables without re-creating the dependent functions and views.

    --Quote me