SQL commands for copying note ID to named field

Shameless gimmethecodez but does anyone know the SQL commands for copying the note ID over to a field called Note ID? If not I can create a new ID for each card in Excel, but it’d be neater to use the existing one.

You can do that using some Python in the debug console:

nids = mw.col.find_notes('deck:mydeck')
notes = []
for nid in nids:
   note = mw.col.get_note(nid)
   note["Note ID"] = str(note.id)
   notes.append(note)

mw.col.update_notes(notes)
2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.