riteinfotech
asked on
how to specify delimiter with bcp commad
i want to create a text file from a table without/with delimeter with specified spaces that i can provide as parameter in bcp command
like
ramdev|sharma // pipe delimeted
and
ramdev sharma // 2 spaces
and i dont want tabs
ramdev (tab space) sharma
thanks
like
ramdev|sharma // pipe delimeted
and
ramdev sharma // 2 spaces
and i dont want tabs
ramdev (tab space) sharma
thanks
you can use -t to specify the feild delimiter
hi there,
try the following, it is using a trusted connection
bcp "[Dbname]..[TableName]" OUT "[FilePath\FileName.DAT]" -t "[Delimeter]" -c -S"[ServerName]" -T
hth
try the following, it is using a trusted connection
bcp "[Dbname]..[TableName]" OUT "[FilePath\FileName.DAT]" -t "[Delimeter]" -c -S"[ServerName]" -T
hth
ASKER
if i want to specify different spaces for every field than what should be exact bcp cpmmand
like i have 6 fields in a table and i want text file like
1 2 3 4 5 6
ramdev[2 space]sharma[10 space]manager[6 space]26[4 space]25000[10 space]1980
and all teh data from table should be copied in same format,in this case what would the exact bcp command
with systax .
please help
like i have 6 fields in a table and i want text file like
1 2 3 4 5 6
ramdev[2 space]sharma[10 space]manager[6 space]26[4 space]25000[10 space]1980
and all teh data from table should be copied in same format,in this case what would the exact bcp command
with systax .
please help
you could just use a SQL query in your bcp command to do that,
so instead of using a table name, put your query into a view, and then execute the view
so instead of using a table name, put your query into a view, and then execute the view
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
bcp .... -t!
i'd suggest using the format file options to attempt to get a double space delimiter...
(see Books on line ....)
hth
rushed
it may help to state you sql version/edition