• I just tested this: you must drop all the objects that use the type, drop and recreate teh type, and then create all the objects that used to use it all over again.

    otherwise you get an error referencing the first dependancy that SQL finds:

    Msg 3732, Level 16, State 1, Line 1

    Cannot drop type 'intVarcharForConCat' because it is being referenced by object 'ConcatStuff'. There may be other objects that reference this type.

    here's a very simple example:

    /* Create a user-defined table type */

    CREATE TYPE intVarcharForConCat AS TABLE

    (

    ID int,

    Descriptor VARCHAR(50)

    );

    --now a function that would do the FOR XML for concatenation.

    GO

    CREATE FUNCTION ConcatStuff(@MyTable dbo.intVarcharForConCat READONLY)

    RETURNS TABLE WITH SCHEMABINDING

    AS

    RETURN(

    SELECT DISTINCT

    t.ID,

    sq.Columns As Descriptors

    FROM @MyTable t

    INNER HASH JOIN (SELECT

    ID,

    Columns = STUFF(

    (SELECT

    ',' + Descriptor

    FROM @MyTable sc

    WHERE sc.ID = s.ID

    FOR XML PATH('')

    )

    ,1,1,'')

    FROM @MyTable s

    ) sq ON t.ID = sq.ID

    )

    GO

    --test just the table type:

    Declare @MyTable dbo.intVarcharForConCat

    INSERT INTO @MyTable

    SELECT OBJECT_ID,name from sys.columns

    SELECT * FROM @MyTable

    --test the concat function

    SELECT * FROM dbo.ConcatStuff(@MyTable)

    --try to drop and recreate just the type:

    DROP TYPE intVarcharForConCat AS TABLE

    CREATE TYPE intVarcharForConCat AS TABLE

    (

    ID int,

    Descriptor VARCHAR(60)--creasing the size, for example

    );

    --now cleanup

    DROP FUNCTION ConcatStuff

    DROP TYPE intVarcharForConCat;

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!