• Nice question Gary!!

    This is how Create procedure and function should be written, so that they work:

    -- Query #4

    USE DBDB;

    GO

    IF OBJECT_ID('dbo.uspUSP') IS NULL

    EXEC ('CREATE PROCEDURE dbo.uspUSP AS SET NOCOUNT OFF')

    GO

    -- Query #6

    USE DBDB;

    GO

    IF OBJECT_ID('dbo.udfUDF') IS NULL

    EXEC ('CREATE FUNCTION dbo.udfUDF(@f int) RETURNS INT AS BEGIN SET @f=1 RETURN @f END ')

    GO

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter