SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Create an ASCII fixed file
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Sivangari
Starting Member

India
16 Posts

Posted - 09/28/2012 :  07:22:49  Show Profile  Reply with Quote
How to create an ascii fixed length file using sql 2008. Need to create using BCP.

Thanks in advance.

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 09/28/2012 :  07:42:22  Show Profile  Reply with Quote
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

India
16 Posts

Posted - 09/28/2012 :  08:23:12  Show Profile  Reply with Quote
Thanks for your reply.I need ASCII fixed file.

Go to Top of Page

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 09/28/2012 :  08:56:49  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2223 Posts

Posted - 09/28/2012 :  09:50:31  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000