Are you looking something like below.
IF NOT EXISTS(SELECT * FROM sys.objects WHERE object_id=OBJECT_ID(N'[dbo].[usp_record_count]') AND type in(N'P',N'PC'))
BEGIN
EXEC dbo.sp_executesql
@statement =N'
CREATE PROCEDURE [dbo].[usp_record_count]
(@tablename sysname)
AS
BEGIN
SET NOCOUNT OFF
EXECUTE (''SELECT COUNT(*) FROM ''+ @tablename )
END'
END
exec usp_record_count 'EmployeeMaster'
Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
Praveen Dsa | MCITP - Database Administrator 2008 | My Blog | My Page
No comments:
Post a Comment