Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 howcreate format file for remote srvr Tables

Author  Topic 

safecoder@gmail.com
Starting Member

22 Posts

Posted - 2005-04-26 : 09:30:24
How do i create a format file for a table which is sitting in remote server...I'm using this comman from command line..

bcp d_db..temp_table format c:/temp.fmt -SS123 -username

Here SS123(Name changed) is my remote server and username for that server(I have the access)...

If i use this, i'm getting message

SQLState = 08001, NativeError = 17
Error = [Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not exist or access denied.
SQLState = 01000, NativeError = 2
Warning = [Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionOpen (Connect()).

Few things here...I dont have a SQL Authentication username..I use Windows authentication mode...Is that the reason why i'm getting denied?

Secondly..Is the command correct?
When i used bcp pubs..Authors format c:/temp.fmt on my persoanl laptop it dumoped all the data from Table into temp.fmt file..But what all i need is table definition...like something which is shown here..
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_impt_bcp_9yat.asp

Let me know guys..Thanks,

bferriter
Starting Member

34 Posts

Posted - 2005-04-26 : 13:23:42
first, your close with your link but I think you need this information instead:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbcsql/od_odbc_bcp_3lmc.asp

Your link references using a format file that already exists, and doesnt cover how to create the file. This link shows how to use the bcp_writefmt. In the menu on the left, click the + sign next to "Bulk-Copy Functions" to see the list (about a dozen or so). It would appear you need to run a few of them in order for this to work, for example you specify the column format with bcp_colfmt or retrieve with bcp_getcolfmt before you try to write the format file.

Second, make sure you specify what fields your representing in your command line. In yours, you did not reference that -SS123 was a host, thats probably why your getting an error. Also if your using windows authentication, you do not need to specify a user / pass, its implied implicitly (at least it is through an access backend). If you read more closely the link you posted, the examples on that page show the correct format for those fields when you try to run the command. You should look at their examples and apply it to your function.

Hope that helps.

--------------------
Brian
One man with 5 hats.
Go to Top of Page
   

- Advertisement -