With a standard ftp session, you would issue a put command to transfer a file to the remote file system from a local file. You can specify a filename for the remote file, or if you leave it blank it will use the filename from the remote file system. However, under SQL-ftpd, this command is being mapped to a SQL server database and hence requires a few operating changes. A synopsis of those changes is given below:
ftp> put "<local-file-name>" <sql-server table name>This will take the delimited data contained in the file named local-file-name and attempt to copy it into the table named sql-server table name on the remote sql server. There must be ((number of columns) - 1) delimiters for each row contained in the data file or else the put command will fail with an error. (There must be the same number of data fields in the file, as there are columns on the sql server table).
Note that the above synopsis assumes you've already issued a cd command to change to the appropriate database.
An example of this command's usage is given below:
ftp sybasedev.acs.ncsu.edu 9220 # connect to port 9220 on sybasedev (sqlftp)
User: <your-sybase-user-id> # remember, we're a front end to sybase
Password: <your-sybase-password> # so your sybase id is what you'll need here.
230 User <your-sybase-user-id> logged in. # and it tells you when you've logged in.
ftp> cd <database name>
250 CWD command successful.
ftp> put countries.txt countries_tab
200 PORT command successful.
150 Opening ASCII mode data connection for nsyslaw..countries_tab.
226- truncated table nsyslaw..countries_tab
Total of 257 rows copied
226 Transfer complete.
8995 bytes sent in 0.0761 secs (1.2e+02 Kbytes/sec)
ftp>
In the preceeding example the file containing data named countries.txt was
sent to the remote sql server. The data contained in the file was inserted
(bulk copied, actually) into the table given by the nomenclature countries_tab,
which is contained in the database nsyslaw. The messages confirm the names,
confirm that the table was truncated before the insertion, and the number of
rows copied into the table. A summary statistics report is sent following,
which has no appreciable meaning (in our case).You may also omit the remote file name, if your local file is the same name as your remote sql-server table. Further, you may also use the construct of db-name..table-name, for your remote table name, if you choose. If you have already changed to the database, the db-name..table-name construct is not necessary.
Again, note that the file must be delimited by some character. The delimiter is the tab character by default, but can be set to any printable character you wish through the use of the site command.