Script generation for SQL Server - how to add 'use <database>' at the beginning of the script

Hello:

I am working on database changes that involve the creation of new tables. Using the Actions mechanism in the DDL Script Generation dialog I generate scripts for the set of tables I added, and I usually set Check Constraint Rules to Drop & Create, Entities to Drop & Create and so on so I can re-run the script many times.

The problem that I have is that I also need to add:

use

go

at the beginning of the script to set the proper context for the script.

How can I do that, so I don’t have to add the two lines manually every time I generate the script?

I added the two lines in the Before Script for each table but the constraint & FKs drop statement happen earlier in the script.

Any suggestions?

Thank you

I solved it by adding the two lines to the Before Script field in the Model Properties dialog.

I am using TDM version 7.3 to model a SQL Server database. I experience this same problem. I have to add the use [DB_...] and go at the beginning of each change script. I also added these two lines to the Before Script tab in the Model Properties. TDM does not include the "use" statement unless I generate the DDL for the entire DB. If I generate the change script, it does not include them. Is this something that worked but then was broken in the current release?