July 1, 2008 at 4:25 pm
SQLState = 28000, NativeError = 18456
Error = [Microsoft][SQL Native Client][SQL Server]Login failed for user 'NT AUTHORITY\SYSTEM'.
SQLState = 42000, NativeError = 4060
Error = [Microsoft][SQL Native Client][SQL Server]Cannot open database "select * from cycledate" requested by the login. The login failed.
NULL
This is the query.
SET QUOTED_IDENTIFIER OFF
declare @output varchar(5000)
SELECT @output ='bcp "select * from cycledate" out "c:\text.txt" -c -q -S -T'
EXEC master..xp_cmdshell @output
I tried to give elevated rights to NT\AUTHORTY\SYSTEM but still get the same error. Has anyone run into this and if so what was your solution
thanks
July 1, 2008 at 8:08 pm
Assuming you are running this query on the SQL Server itself, try this (substitute dbname.schema with whatever database & schema the table is in):
[font="Courier New"]SELECT @output ='bcp "select * from dbname.schema.cycledate" queryout "c:\text.txt" -c -q -S -T'
[/font]
MARCUS. Why dost thou laugh? It fits not with this hour.
TITUS. Why, I have not another tear to shed;
--Titus Andronicus, William Shakespeare
July 1, 2008 at 8:28 pm
Scott,
Thanks very much it works like a charm as:
SELECT @output ='bcp "Select * from cycleprocess.dbo.cycledate" queryout "c:\text.txt" -c -q -S -T'
Rick
ex Wentworthville guy 🙂
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply