I am trying to export the sql script data to pipe delimited text file.
I did below steps
1. JOined the sql tables and wrote the sql script.
2. export the results to glbal temp table.
3. then BCP the results to pipe delimited text file.
here is the select query
Select dbo.FN_Decrypt(@master, Login.LoginSkey,PatientDisplayID) as 'Client ID', ISNULL(SugarEntryCount,0) as 'BG Count',
ISNULL(CarbsEntryCount,0) as 'Carb Count', ISNULL(MedsEntryCount,0) as 'Med Count'
FROM #temp_patients inner join Login ON Login.LoginID = #temp_patients.PatientID
Microsoft is conducting an online survey to understand your opinion of the Technet Web site. If you choose to participate, the online survey will be presented to you when you leave the Technet Web site.