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 |
|
spock
Starting Member
35 Posts |
Posted - 2002-02-15 : 23:35:11
|
Hii have an employee table liketable employee( emp_id int, orgn_id int, mgr_id int, e_mail varchar(60), emp_frst_name varchar(60), emp_last_name varchar(60))i need to send an email to all the managers about the employees under them. the client says there are instances of a manager having aroung 110 employees reporting to him . i thought i could build a string of all the names comma separated in a column (using all the prev posts and articles in sqlteam abt building csv i was able to do that and get it working ) and return it to my vb program which would then mail the names to the respective manager. but then it struck me that 110 * 120 (total names * the size of the name field) would cross the row limit of 8000 bytes. so i am thinking that the only solution would be to run the queryselect emp_frst_nme,emp_lst_nme from employee where mgr_id = 2134 and then append the names to the email by reading each of these names into the mail body from the recordset .so what would your suggestion be guys ?thankskaushik |
|
|
joldham
Wiseass Yak Posting Master
300 Posts |
Posted - 2002-02-18 : 21:37:40
|
| One option would be to open a recordset and then create an array and use array_variable = rs.getrows. Then you can immediately close the connection to the database and loop through the array values setting the mail message as follows:For iRowLoop = 0 to UBound(array_variable,2)message_variable = message_variable & aTable1Values(1,iRowLoop) & ", "NextThis would keep database connection to a minimum and allow the programming to be done on the client side. This is especially beneficial when programming web pages.Let me know if this helps. |
 |
|
|
spock
Starting Member
35 Posts |
Posted - 2002-02-18 : 22:03:31
|
joldham,quote: Let me know if this helps.
it was definetely helpful. was able to get that working.thanks kaushik |
 |
|
|
|
|
|