EXEC master..xp_cmdshell 'bcp "select USERID_FK FROM ADM_USERROLES" queryout "D:\bcptest.txt" -T -c -t,'
MSDN:Because malicious users sometimes attempt to elevate their privileges by using xp_cmdshell, xp_cmdshell is disabled by default. Use sp_configure or Policy Based Management to enable it. For more information, see xp_cmdshell Server Configuration Option.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)