June 3, 2009 at 3:28 am
Hi,
I need to do a bcp out for a query. But I am not able to get a fixed width txt file as the output.
what are the various parameters to be set in the bcp?
December 16, 2009 at 9:21 am
Here is a "trick"
casting as a char(XX) where XX is your fixed-width
bcp "SELECT cast(LastName as char(50)) , cast(FirstName as char(50)) , cast(MiddleName as char(50)) , cast(Suffix as char(50)) FROM AdventureWorks2008.Person.Person ORDER BY LastName, Firstname" queryout PeopleAreCool.txt -c -T -SMySqlServer\MyInstanceName
Note, that is a 2008 AdventureWorks db from code plex. Your AW db might need a slight sql-select update. But the skeleton is there.
..
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy