IF OBJECTPROPERTY(OBJECT_ID('dbo.RefreshArtistsData'), 'IsProcedure') = 1
BEGIN
    DROP PROCEDURE dbo.RefreshArtistsData
    IF OBJECTPROPERTY(OBJECT_ID('dbo.RefreshArtistsData'), 'IsProcedure') = 1
        PRINT '<<< FAILED DROPPING PROCEDURE dbo.RefreshArtistsData >>>'
    ELSE
        PRINT '<<< DROPPED PROCEDURE dbo.RefreshArtistsData >>>'
END
go
CREATE PROCEDURE RefreshArtistsData
--WITH ENCRYPTION
AS
/********************************************************************************/
/*      Created By :    Umachandar Jayachandran (UC)                            */
/*      Created On :    3 Feb 2000                                              */
/*      Description:    This SP is used to refresh the data for the Artists tbl */
/*                      from the Windows 2000 DeluxeCD database.                */
/*                      Using the view that contains the distributed query will */
/*                      cause SQL Server to generate Access Violation. Hence,   */
/*                      temporary table workaround.                             */
/********************************************************************************/
/*      Resources  :    https://umachandar.com/resources.htm                 */
/********************************************************************************/
CREATE TABLE #A (Artist VARCHAR(255))
INSERT #A SELECT DISTINCT Artist FROM [DeluxeCD Titles]
INSERT Artists
SELECT Artist, 0, '', 0, 0  FROM #A
WHERE NOT EXISTS(SELECT * FROM Artists A WHERE A.Artist = #A.Artist)
go
IF OBJECTPROPERTY(OBJECT_ID('dbo.RefreshArtistsData'), 'IsProcedure') = 1
BEGIN
    GRANT EXECUTE ON dbo.RefreshArtistsData To Public
    PRINT '<<< CREATED PROCEDURE dbo.RefreshArtistsData >>>'
END
ELSE
    PRINT '<<< FAILED CREATING PROCEDURE dbo.RefreshArtistsData >>>'
go
This page was last updated on May 01, 2006 04:28 PM.