[dba-SQLServer]More on sp_refreshview

Nicholson, Karen knicholson at gpsx.net
Wed Jul 9 09:55:09 CDT 2003


Daaa.... I changed the first reference to refresh only views. But it chokes,
thinking that Check_Constraints is not a valid name for a view, but it is.
What the $#&^$%$% ??

DECLARE @objName VARCHAR(50)
SET	@objName = ''

WHILE	@objName IS NOT NULL
	BEGIN
		SELECT @objName = MIN( Name )
		FROM	SysObjects
		WHERE	Type='V' AND
			Name > @objName

		/*IF	@objName IS NOT NULL
				exec sp_refreshview @objName		*/
END

SET	@objName = ''

WHILE	@objName IS NOT NULL
	BEGIN
		SELECT @objName = MIN( Name )
		FROM	SysObjects
		WHERE	Type='P' AND
			Name > @objName

		IF	@objName IS NOT NULL
				exec sp_recompile @objName		
END




More information about the dba-SQLServer mailing list