.\"Text automatically generated by txt2man .TH defncopy 1 "13 November 2011" "doc" "FreeTDS Utilities" .SH NAME \fBdefncopy \fP- extract procedures and views from a Microsoft server. \fB .SH SYNOPSIS .nf .fam C \fBdefncopy\fP [\fB-U\fP \fIusername\fP] [\fB-P\fP \fIpassword\fP] [\fB-S\fP \fIserver\fP] [\fB-D\fP \fIdatabase\fP] [\fB-i\fP \fIinput_file\fP] [\fB-o\fP \fIoutput_file\fP] [\fB-v\fP] [owner.]object_name [[owner.]object_name\.\.\.] .fam T .fi .fam T .fi .SH DESCRIPTION \fBdefncopy\fP is a utility program distributed with FreeTDS. It replaces a similar program of the same name distributed by Sybase. .PP \fBdefncopy\fP 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. .SH OBJECTS .TP .B owner is optional if you or the \fIdatabase\fP owner is the owner of the procedure/view being copied. .TP .B object_name is the name of the system object you wish to extract. .SH OPTIONS .TP .B \fB-U\fP \fIusername\fP \fIdatabase\fP \fIserver\fP login name. .TP .B \fB-P\fP \fIpassword\fP \fIdatabase\fP \fIserver\fP \fIpassword\fP. .TP .B \fB-S\fP \fIserver\fP \fIdatabase\fP \fIserver\fP to which to connect. .TP .B \fB-D\fP \fIdatabase\fP \fIdatabase\fP to use. Optional if the procedure/view being extracted is in your default \fIdatabase\fP. .TP .B \fB-i\fP \fIinput_file\fP a script to apply to the \fIdatabase\fP. Not currently implemented. .TP .B \fB-o\fP \fIoutput_file\fP a file to hold the script, defaults to standard output. .TP .B \fB-v\fP Show version information and copyright notice. .SH NOTES \fBdefncopy\fP is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The \fB-i\fP and \fB-o\fP options override these, of course. .PP \fBdefncopy\fP makes use of the db-lib API provided by FreeTDS. This API is of course also available to application developers. .SH EXIT STATUS \fBdefncopy\fP exits 0 on success, and >0 if the \fIserver\fP cannot process the query. .PP \fBdefncopy\fP will report any errors returned by the \fIserver\fP, but will continue processing. .SH HISTORY \fBdefncopy\fP first appeared in FreeTDS 0.63. .SH AUTHORS The \fBdefncopy\fP utility was written by James K. Lowden .SH BUGS Works only with Microsoft servers and ancient Sybase servers. .PP Does not create primary keys. .PP Many options are defined by Sybase that this version does not implement. Feel free to correct this situation. .PP In theory, \fBdefncopy\fP could apply/produce DDL for any system object, but at present only tables, procedures and views are supported, and only for extraction.