There have been plenty of posts on the Adobe InDesign Forum lately concerning issues that users are having with data merge, particularly Multiple Record Data Merge (MRDM) projects. These projects could be “stepping up” artwork onto a larger sheet for trimming (e.g. Imposing many business cards onto one sheet) or preparing catalogues for example.
I would like to delete a specific record from two or more tables which are linked to one another.
For Example: I have two tables, Students and winners I would like to delete the names Roy and Peter from both the tables in one shot.
table: Students
table: Winners
I have more than 100 tables with 50 specific records to be deleted from all the tables.
l.lijithl.lijith4302 gold badges7 silver badges17 bronze badges
4 Answers
You have to achieve this using Dynamic SQL Query
1- First you have to list all Tables With there Corresponding Databases in a Temp Table2- Building Query for databases that contains
Students
and Winners
dataTableYour script should look like
This Will Result a query like the following (If these databases contains
Students
and Winners
Table)I don't Now if that is what you was asking for in your question below (Your question was not specific like this one, so my answer was providing the dynamic sql logic in general)
HadiHadi
You are going to have to explicitly list the tables from which you need to delete anyway.
One of the scenarios would be to create a table with the list of tables you want to delete from and loop through each one of them applying appropriate
delete
statement based on id's
of the students with specific names.To loop through all tables in the database you may use something like this:
And do not forget to test
delete
in Test environment.![Indesign data merge not working Indesign data merge not working](/uploads/1/2/4/9/124990971/266811910.gif)
George KGeorge K
I think correct approach is to first Delete Record from Student table without dynamic sql and store the deleted ID in temp table.
like this,
In above example I do not have to use 'where name in()' every time.I use it once and store it in temp table.
For Example I am using Adventure DB,
KumarHarshKumarHarsh
From SQL DELETE
Most database management systems allow you to create a foreign key constraint so that if you delete a row in a table, the corresponding rows the related table are also removed automatically. This ensures the integrity of the data.
AND
Answered in SO. (Must be adapted to your situation)
Can't you just separate them by a semicolon?
OR
Just use INNER JOIN as below
EDIT due to @NIC's comment (and DV?):
First option:table_constraint (Transact-SQL)
ON DELETE { NO ACTION | CASCADE | SET NULL | SET DEFAULT } Specifies what action happens to rows in the table that is altered, if those rows have a referential relationship and the referenced row is deleted from the parent table. The default is NO ACTION.
...
CASCADE Corresponding rows are deleted from the referencing table if that row is deleted from the parent table.
...
and an example in SO
Second option:
prepare tables
Deleting rows
Tested in SQL Server 13.0.1722.0note: DROP TABLE IF EXIST may not work in older versions
Community♦
HEDMONHEDMON
Not the answer you're looking for? Browse other questions tagged sql-serversql-server-2008t-sqldelete or ask your own question.
I am having troubles with getting data imported with data merge to display on one page.
What I need:
- On the left page I have 'static' info that I will customize myself.
- On the right page I want a table that is created through datamerge.
- When the right page is not sufficiently big enough for all thevalues then indesign has to add another set of these 2 pages. (on theright page the table continues, on the left page my 'static' page isduplicated)
![Merge Merge](/uploads/1/2/4/9/124990971/395735077.png)
Now when I merge the date from my .csv file InDesign creates a whole new 'book' per value in my list:
creates book per value:
In the data merge menu I can not select 'multiple records per page' this is just greyed out. I can however achieve what I wan't (multiple records per page) in a seperate document with just a single page.
I am still very new to the data merge function in indesign and have no idea if what I'm trying to achieve is possible.
Piet Pol Pet
migrated from stackoverflow.comSep 2 '16 at 15:16
This question came from our site for professional and enthusiast programmers.
2 Answers
with data merge, indesign generates the whole document for each line, that's why you have to merge your data on one page.
create only one page, merge your data here and after generating merged document you can add the other pages at above and below of the document.
or you can use 'inlinemerge' script, search this on google. it doesn't generate a new document.
Barış ÇelikBarış Çelik
I think the inlinemerge script Baris Celik mentioned will help you solve your problem. It allows you to create a template within a text frame that the script will repeat for each record. You can read about it on Indesign Secrets. In the article it makes it sound like you have to use anchored objects but works with regular text as well.
jseymour186jseymour186