Soldato
Hi all,
I've been asked to automate a report that we have to manually run each week.
I've got the SQL from the report, save it to a ##table.
I then BCP this to a shared drive as a CSV file using: EXEC master..xp_cmdshell
I then email this out using: EXEC msdb.dbo.sp_send_dbmail
The problem I have is that the BCP cmd only works with our Dataload account, it's like an admin account (i have no idea if this is just our name for it or if it's universal)
The email part will only work when I connect with my personal windows account.
I've a few other tweaks I need to do but does anyone know with what permissions an SP runs? It'll be running via an agent job. Never touched anything like this and there's a distinct lack of decent tutorials for TSQL. It's either noob level selects or it's like reading a technical journal that's been translated from Japanese to Dutch to English.
Can you set permissions in an SP? Can you switch them/reconnect halfway through or would looking at 2 SP's be better?
My other option is DTS packages. Yes, we still use them but I think they want to get rid asap.
I've been asked to automate a report that we have to manually run each week.
I've got the SQL from the report, save it to a ##table.
I then BCP this to a shared drive as a CSV file using: EXEC master..xp_cmdshell
I then email this out using: EXEC msdb.dbo.sp_send_dbmail
The problem I have is that the BCP cmd only works with our Dataload account, it's like an admin account (i have no idea if this is just our name for it or if it's universal)
The email part will only work when I connect with my personal windows account.
I've a few other tweaks I need to do but does anyone know with what permissions an SP runs? It'll be running via an agent job. Never touched anything like this and there's a distinct lack of decent tutorials for TSQL. It's either noob level selects or it's like reading a technical journal that's been translated from Japanese to Dutch to English.
Can you set permissions in an SP? Can you switch them/reconnect halfway through or would looking at 2 SP's be better?
My other option is DTS packages. Yes, we still use them but I think they want to get rid asap.