Tech Off Thread

1 post

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

User Defined Types in SQL 2000

Back to Forum: Tech Off
  • User profile image
    qwert231

    I want to create a script that checks for any tables that might have a column using a specific User Defined Type. If there are none, I want to see if that user defined type exists. If it does, I want to drop it and recreate it.

    I can drop it and recreate it, but how do I do my 2 checks?

    if not exists (tables using myType) -- Need help here --
    begin
     if exits (myType) -- and here --
     begin
      sp_droptype 'myType'
     end

     EXEC dbo.sp_addtype N'myType', N'smallint',N'null'
    end

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.