USE [Users_mdb]
GO
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[EmployeeAssetsCount]'))
DROP VIEW [dbo].[EmployeeAssetsCount]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[EmployeeAssetsCount]'))
EXEC dbo.sp_executesql @statement = N'CREATE VIEW [dbo].[EmployeeAssetsCount]
AS
SELECT     nID, COUNT(nAssetID) AS Number_of_Assets
FROM         dbo.EmployeeAssets
GROUP BY nID
' 
GO
