Book a Demo

Author Topic: DDL Generation  (Read 2383 times)

Legolas

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
DDL Generation
« on: April 07, 2014, 10:01:01 pm »
Hello all,

I use EA to create a datamodel and generate DDL scripts for SQL Server.

The first lines in the resulting script drop the foreign key constraints and then drop the tables themselves.

As generated these statements are split over 2 lines, the first being an IF statement checking for existance, the second the actual drop statements.

Keeping this statement on 2 lines always result in an error, while joining the lines onto a single line works fine.

Is there a way to have EA generate these statements on a single line?

Here's an example:
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id('SCHEMA.FK_MYTABLE_MYOTHERTABLE') AND OBJECTPROPERTY(id, 'IsForeignKey') = 1)
ALTER TABLE SCHEMA.MYTABLE DROP CONSTRAINT FK_MYTABLE_MYOTHERTABLE;

Thanks in advance,
Marcel

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: DDL Generation
« Reply #1 on: April 10, 2014, 12:39:16 am »
Hello Marcel,

with:
Tools, MDA Transformation Templates
you reach the templates.

Choose Language = DDL.

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)