Hello all.
I'm not highly experienced with SQL programming. I must export to contents
of a table to a formated text file which is then send to the customer. Is
there a possibility to do this from within a sql statement?
TIA
RonaldHi Ronald,
You can call the BCP utility from your SQL code. The BCP utility
enables you to export a table or query results to a file. You should
consult Books Online for information about BCP and find what
switches/options are suitable to your situation.
Now, normally you would call BCP from a command line (e.g. a DOS
prompt) but you can also call it from SQL code by going:
exec master..xp_cmdshell 'bcp <rest goes here>'
Note that by default only users in the SysAdmin fixed server role can
call xp_cmdshell.
Hope that helps a bit|||Yes
1)Use BCP to create the file - make sure all permissions are set up.
2)You can send the email from within the sp - SQL server has some built in
functionality or you can install 3rd party dll such as
http://www.sqldev.net/xp/xpsmtp.htm
--
Jack Vamvas
___________________________________
Receive free SQL tips - www.ciquery.com/sqlserver.htm
___________________________________
"Ronald Hermans" <rhermans@.datamedicare.nl> wrote in message
news:OuwKwAAdGHA.536@.TK2MSFTNGP02.phx.gbl...
> Hello all.
> I'm not highly experienced with SQL programming. I must export to contents
> of a table to a formated text file which is then send to the customer. Is
> there a possibility to do this from within a sql statement?
> TIA
> Ronald
>|||Ive read this question and i want something similar..but automatic.
I say every friday sql creates a text file with the contents from a
table, and sends to the server for the client can download it from the
internet..
It can be done with BCP too?|||encase your stored procedure AS as a JOB . Make sure you place the file in
the correct destination and naming is correct for download.
Will your client be downloading from a web site?
--
--
Jack Vamvas
___________________________________
Receive free SQL tips - www.ciquery.com/sqlserver.htm
___________________________________
"Pp" <josemariabarros@.gmail.com> wrote in message
news:1147255005.925240.12610@.j33g2000cwa.googlegroups.com...
> Ive read this question and i want something similar..but automatic.
> I say every friday sql creates a text file with the contents from a
> table, and sends to the server for the client can download it from the
> internet..
> It can be done with BCP too?
>|||Yes. it will put a username and password to enter in a administration
web site and then he can download it|||Thanx,
That did the trick.
"Ronald Hermans" <rhermans@.datamedicare.nl> schreef in bericht
news:OuwKwAAdGHA.536@.TK2MSFTNGP02.phx.gbl...
> Hello all.
> I'm not highly experienced with SQL programming. I must export to contents
> of a table to a formated text file which is then send to the customer. Is
> there a possibility to do this from within a sql statement?
> TIA
> Ronald
>