export to text file

  • How can i export data from 10 different database to a single text file (ASCII) using bcp in which few columns has to be masked(***).

  • Could you give some more detail.

    I don't understand what you mean by " ...in which few columns has to be de identofied. ..."

  • OK, Actually i was able to export data into text files by each table using import/exp[ort wizard but i would like to get data from 10 different databases inot a single file and i would also want to mask few columns as i have ot protect some sensitive data whille whne exportign to text.

  • You could use the Export Wizrd, 1 for each database, then save them and run all 10 at once in a job. The first one creates (or truncates) the file, and the next 9 append to the existing file. You can "ignore" the columns you don't want.

    Not the most glamorous solution, but should be simple to set up.

  • I understand using the export wizard but how can i mask few columns?

  • Please will you post some sample data showing what you have in your source tables, and what you want your target text file to look like.

    Thanks

    John

  • say for example if i have a column for "SSN" it should appear as

    *** ** ***7

    in the text file.

  • With that level of detail, I can't be more specific than to suggest you use the REPLACE function.

    Also, have you considered using SSIS instead of bcp? You may find that it provides more flexibility.

    John

  • Tara-1044200 (1/19/2011)


    I understand using the export wizard but how can i mask few columns?

    Sorry, I was thinking of "ignore" which will eliminate the column from the output completely. So if your table has 10 columns, only 9 would appear in your text file.

    You could probably select "write a query ..." option and use REPLACE as John Mitchell suggested.

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply