Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
pitt1
Starting Member
16 Posts |
Posted - 2006-02-20 : 04:42:28
|
| Hi folks,I'm a novice in sql server, I would like to know how to convert a table into a text, that is, i actually want to send a table by mail, and i think i can't really send the table itself, i have to convert it into text,i'll appreciate if someone can show how to write the stored procedure for that, thanks a lot,Pitter |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2006-02-20 : 05:02:07
|
| you can also use a sproc on Vyas' website that will generate the insert statements for your table using standard SQL.http://vyaskn.tripod.com/code.htm#insertsthis might be easier to use than a file created with BCP.-ec |
 |
|
|
pitt1
Starting Member
16 Posts |
Posted - 2006-02-20 : 10:21:41
|
| thnks guys,i used the following stored procedure:EXEC master.dbo.xp_sendmail @recipients = email@loc.com', @query = 'SELECT * FROM pubs.pite1.tblDATA', @subject = 'SQL Server Report', @message = 'The contents of INFORMATION_SCHEMA.TABLES:', @attach_results = 'TRUE', @width = 250i have encountered couple of problems, 1. if the table is quite big, i'm getting this message from the server : "Server: Msg 18025, Level 16, State 1, Line 0xp_sendmail: failed with mail error 0x80004005"if i'm selecting less rows it works just fine2. how can i send the table as an excel sheet ? and not just as a text..regards,pitter |
 |
|
|
jhermiz
3564 Posts |
Posted - 2006-02-20 : 11:36:29
|
Have you looked at xp_sendmail ?You can send query outputs via emails as .csv files. Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]RS Blog -- [url]http://weblogs.sqlteam.com/jhermiz[/url] |
 |
|
|
pitt1
Starting Member
16 Posts |
Posted - 2006-02-20 : 14:02:41
|
| yes i looked at xp_sendmail...i still geting this mesage from the server:Server: Msg 18025, Level 16, State 1, Line 0xp_sendmail: failed with mail error 0x80004005"i think its because the table is just too big...(if i'll selecet less less rows it will work just fine) any suggestions ??Regards,pitter |
 |
|
|
|
|
|
|
|