Toad World® Forums

before script templates

IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N’[dbo].[v_pclAuditProcessing]’))

Was to create a before script containing:
IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N’<%<%FullNmae%>%>’))
DROP VIEW <%<%FullNmae%>%>
GO

Unfortunately the attempt was unsuccessful.

Thanks in advance,
Terry

How would I go about adding “drop” logic to a before script using variables?

My attempt to create a view before script template… generating the following:DROP VIEW [dbo].[v_pclAuditProcessing]

GO

Hi,

in the script, you made a mistake in <%FullName%>.

And TDM can do this automatically:

  1. In the DDL Script Genaration wizard, tab What to Generate, at Views set Drop and Create.
  2. tab Deatail Settings, select Check Object Existence Before Processing Drop Commands.

That’s it!

Regards,
Lukas

Thanks Lucas; a question however; will the DROP then be generated when using the generate alter script “flow” from the Sync & Convert Wizard?

I’ll try it and see, but I did not believe that was the case.

Thanks again.

Lukas

Your suggestion appears to be the cleanest approach, thank you!
Terry

Hi Terry,

pleased to assist you!

Regards,
Lukas