The defncopy utility copies definitions for specified procedures, views, or Adaptive Server Anywhere triggers from a database to an operating system file or from an operating system file to a database.
defncopy [-I interfaces_file] [-P password] [-R remote_server_principal] [-S [server_name]] [-U username] [-z language] { in file_name database_name | out file_name database_name [owner.]object_name [[owner.]object_name...] }
or
defncopy -v
-I interfaces_file Specifies the name and location of the interfaces file to search when connecting to Sybase IQ. If you do not specify -I, defncopy looks for a file named interfaces in the directory specified by the SYBASE environment variable in UNIX platforms, and sql.ini in the ini subdirectory for your Sybase release directory in Windows.
-P password Specifies your password. If you do not specify -P, defncopy prompts for your password.
-R remote_server_principal Specifies the principal name for the server. By default, the principal name of the server matches the network name of the server (which is specified with the -S parameter or the DSQUERY environment variable). Use the -R parameter when the principal name of the server and network name of the server are not the same.
-S server_name Specifies the name of the Sybase IQ server to which to connect.
If you specify -S with no argument, defncopy looks
for a server named SYBASE. If you do not specify -S, defncopy uses
the server specified by your DSQUERY environment variable. If you
do not specify -S and the DSQUERY environment
variable is not set, the following error message is returned: “FATAL
ERROR: A server name has not been specified. Check the value of
your DSQUERY environment variable.”
-U username Specifies a login name. Login names are case sensitive. If you do not specify username, defncopy uses the operating system login name of the current user.
-z language The official name of an alternate language that the server uses to display defncopy prompts and messages. Without the -z flag, defncopy uses the default language of the server.
The alternate language specified in the -z parameter can be one of the ten languages (and Unicode) provided by default in the $SYBASE/locales directory. These languages include Chinese, French, German, Japanese, Korean, Polish, Portuguese, Spanish, Thai, Unicode, and US English. If you specify a language that is not included in $SYBASE/locales, defncopy prompts and messages default to US English. In this cae, an informational message is returned to let you know that defncopy is using the default language US English. Additional language licenses can be purchased separately.
in | out Specifies the direction of definition copy.
file_name Specifies the name of the operating system file destination or source for the definition copy. The copy out overwrites any existing file.
database_name Specifies the name of the database to copy the definitions from or to.
owner Optional if you or the Database Owner own the table being copied. If you do not specify an owner, defncopy first looks for a table of that name that you own, and then looks for one owned by the Database Owner. If another user owns the table, you must specify the owner name or the command fails.
object_name Specifies name(s) of database object(s) for defncopy to copy out. Do not use object_name when copying definitions in.
-v Displays the version and copyright message of defncopy and returns to the operating system.
Use this syntax for defncopy if you are using threaded drivers on the IBM platform.
You must set the SYBASE environment variable to the location of the current version of Sybase IQ before you can use defncopy.
Invoke the defncopy program directly from the operating system. defncopy provides a non interactive way to copy out definitions (CREATE statements) for views, rules, defaults, triggers, or procedures from a database to an operating system file. Alternatively, it copies in all the definitions from a specified file.
The in filename or out filename and the database name are required and must be stated unambiguously. For copying out, use file names that reflect both the name and owner of the object.
defncopy ends each definition that it copies out with the comment:
/* ### DEFNCOPY: END OF DEFINITION */
Definitions created as text must end with this comment so that defncopy can copy them in successfully.
Enclose values specified to defncopy in quotation marks, if they contain characters that could be significant to the operating system shell.
WARNING! Long comments of more than 100 characters that are placed before a CREATE statement may cause defncopy to fail.
You must have SELECT permission on the SYSOBJECTS and SYSCOMMENTS tables to copy out definitions; you do not need permission on the object itself.
You must have SELECT permission on the SYSPROCEDURE table to copy out stored procedure definitions and SELECT permission on the SYSTABLE table to copy out view definitions.
If you do not have SELECT permission on the text column of the syscomments table, the object owner or a System Administrator must execute defncopy to copy out definitions.
If the text has been encrypted, it may be hidden from you even if you have all the required permissions. See Encrypted Columns in Sybase IQ for more information.
You must have the appropriate CREATE permission for the type of object you are copying in. Objects copied in belong to the copier. A System Administrator copying in definitions on behalf of a user must log in as that user to give the user proper access to the reconstructed database objects.
Example 1 Copies definitions from the file new_proc into the database stagedb on server MERCURY. The connection with MERCURY is established with a user of name “sa” and a NULL password:
defncopy -Usa -P -SMERCURY in new_proc stagedb
Example 2 Copies definitions for objects sp_calccomp and sp_vacation from the employees database on the SYBASE server to the file dc.out. Messages and prompts display in french. The user is prompted for a password:
defncopy -S -z french out dc.out employees sp_calccomp sp_vacation
“CREATE PROCEDURE statement,” “CREATE PROCEDURE statement [T-SQL],” “CREATE VIEW statement,” and “SELECT statement” in Chapter 6, “SQL Statements” of the Sybase IQ Reference Manual
“sp_iqprocedure procedure,” “sp_iqview procedure,” “sp_iqhelp procedure,” and “sp_iqcheckdb procedure” in Chapter 10, “System Procedures” of the Sybase IQ Reference Manual