question

AbhiD avatar image
AbhiD asked

How to create these type of files?

i have file/table in my database with the following format account_name (blank) Trade_date Price sam by 09012010 102.3 jaz by 09012010 101.8 mike by 09122010 104.3 sam by 09132010 105.5 i want to achieve the output like this first of all a file should be created as (account_number).dex so foe example :- file created sam.dex with entries like sam by 09012010 102.3 sam by 09132010 105.5 2 nd file created:- jaz.dex with entries jaz by 09012010 101.8 3rd file created:- mike.dex with entries mike by 09122010 104.3 How to achieve this output? thanks in advance!!!
ssistsql
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Tim avatar image
Tim answered
Are you looking for this to be dynamic to be able to include any new account numbers that come in or is your data set going to remain static? If static a simple DTS, SSIS, or even TSQL statements using SQLCMD could pipe the results out to file. What version of SQL are you running and what are your full requirements?
2 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

The number of entries in my source file will be dynamic ..sometimes it may be 10 records and sometime it can reach 100 also. i m using sql server 2005. Can u tell me what should be the approach if i plan to use ssis?
0 Likes 0 ·
You could use a foreach loop and get the distinct account number, then pass each account number to a stored procedure or query to get the individual result set per account number. Those results could be written to individual files and use the account number in the output file name.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.