DEFNCOPY(1)

🌸 NAME 🌸

okay bestie, this is the defncopy page β€” LOCAL manual, section 1 β€” and defncopy means extract procedures and views from a Microsoft server. πŸ’…βœ¨ iykyk.

✨ SYNOPSIS ✨

defncopy [-v] [-U username] [-P password] [-S server] [-D database]
         [-i input_file] [-o output_file] [owner.object_name
         [owner.object_name ...]]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so defncopy is a utility program distributed with FreeTDS. It replaces a similar program of the same name distributed by Sybase β€” iconic succession moment, honestly. 🫢

It reads the text of a stored procedure or view, and writes a script suitable for recreating the procedure or view. For tables, it reads the output of sp_help and constructs a CREATE TABLE statement, complete with CREATE INDEX, too. That's the whole glow-up: text in, recreate-ready script out. ✨

The owner part is optional if you or the database owner is the owner of the procedure/view being copied. The object_name is the name of the system object you wish to extract. yep, that's the assignment, periodt. πŸ’–

πŸ’… OPTIONS πŸ’…

  • -U username β€” database server login name.
  • -P password β€” database server password.
  • -S server β€” database server to which to connect.
  • -D database β€” database to use. Optional if the procedure/view being extracted is in your default database.
  • -i input_file β€” a script to apply to the database. Not currently implemented. (sad girlie hours 😭)
  • -o output_file β€” a file to hold the script, defaults to standard output.
  • -v β€” Show version information and copyright notice.

🧚 NOTES 🧚

defncopy is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The -i, -o, and -e options override these defaults. lowkey filter behavior is the main character here. 🌈

defncopy makes use of the db-lib API provided by FreeTDS. This API is of course also available to application developers. sharing is caring, bestie. 🫢

⭐ EXIT STATUS ⭐

defncopy exits 0 on success, and >0 if the server cannot process the query. πŸŽ€

defncopy will report any errors returned by the server, but will continue processing. dramatic? maybe. but it keeps going. πŸ’…

πŸ¦‹ HISTORY πŸ¦‹

defncopy first appeared in FreeTDS 0.63. vintage-ish, but make it slay. ✨

πŸ‘‘ AUTHORS πŸ‘‘

The defncopy utility was written by James K. Lowden <jklowden@schemamania.org.>. πŸ’–

πŸ’€ BUGS πŸ’€

⚠️ Works only with Microsoft servers and ancient Sybase servers. Does not create primary keys. Many options are defined by Sybase that this version does not implement. Feel free to correct this situation.

In theory, defncopy could apply/produce DDL for any system object, but at present only tables, procedures and views are supported, and only for extraction. that's the limit, bestie β€” extraction only, no cap. πŸ™ˆ


this page is from FreeTDS 1.5.20, dated April 26, 2012, and the footer energy is DEFNCOPY(FreeTDS) β€” byeee, go extract something cute! πŸŽ€πŸ’–

πŸ“¦ where this page comes from