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
 General SQL Server Forums
 New to SQL Server Programming
 Create an ASCII fixed file

Author  Topic 

Sivangari
Starting Member

16 Posts

Posted - 2012-09-28 : 07:22:49
How to create an ascii fixed length file using sql 2008. Need to create using BCP.

Thanks in advance.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-09-28 : 07:42:22
Cast the columns that you want to BCP out as fixed with characters, for example CHAR(100) etc.
Go to Top of Page

Sivangari
Starting Member

16 Posts

Posted - 2012-09-28 : 08:23:12
Thanks for your reply.I need ASCII fixed file.

Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-09-28 : 08:56:49
My understanding of "Fixed width ASCII file" is a file which has the same number of characters in every line (and if it represents more than one column of data, each column has a fixed width as well), the fixed width achieved via padding with spaces.

If that is the case, what I described earlier would do it. If that is not what you mean, can you explain what you mean by fixed width file?
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-09-28 : 09:50:31
To create ASCII format file,

Check this URL, it may help you
http://blog.ijun.org/2008/12/importing-and-exporting-data-with-sql.html



bcp pubs..publishers out publ_out /c /Sservername /Usa /Ppassword

here \c fixed length character format


--
Chandu
Go to Top of Page
   

- Advertisement -