November 26, 2007 at 10:32 pm
No change the same error ......
Access Denied
Null
Anujahnavi S.
November 26, 2007 at 10:35 pm
No change the same error ......
Access Denied
Null
Anujahnavi S.
November 26, 2007 at 10:46 pm
Hi Anu,
change the output path to "C:\Save.txt" and try it.
FYI:
----
Create Trigger TestTrigger1
On dbo.tablefortrigger
For Insert
As
Begin
Set nocount on
Declare @msg nvarchar(255) /*Check sp_addmessage */
Declare @CmdString nvarchar (2000)
set @msg = 'Inserted \ tablefortrigger \' + convert(varchar(20), getdate()) + ' — '
+(select convert(varchar(5), track)
+ ',' + lastname + ', ' + firstname
from inserted)
RAISERROR(50006,10,1,@msg)
Set @CmdString = 'echo ' + @msg + ' > C:\save.txt'-- changed.
EXEC master..xp_cmdshell @CmdString
Set nocount off
End
Go
November 26, 2007 at 10:47 pm
Hi,
try to save to c: drive
Set @CmdString = 'echo ' + @msg + ' > C:\Documents and Settings\admin\Desktop\save.txt'
November 26, 2007 at 10:49 pm
No Ahmed No change in the error.
Access Denied
NULL
Don't think iam eating ur brain.
Pleaseee......
Anujahnavi S.
November 26, 2007 at 10:59 pm
Did u check my post...
Actually change the .txt file path to C:\Save.txt.
November 26, 2007 at 11:00 pm
Hi,
try to save to c: drive I meant Set @CmdString = 'echo ' + @msg + ' > C:\save.txt'
I meant you dont have write to create file in C:\Documents and Settings\admin\Desktop
Regards
November 26, 2007 at 11:09 pm
yes Ahmed i placed it in d: drive.
When i place the .txt file in c: i din't get but when i placed it in d:
one row in the output was removed(i.e., Access denied) is rectified but ...........
That second row is not yet..........
Null is stinn there.
Actual Result is
1..........Inserted \ tablefortrigger \Nov 27 2007 11:33AM — 6,Nori, Prathi
2..........(1 row(s) affected)
but iam getting only
1..........Inserted \ tablefortrigger \Nov 27 2007 11:33AM — 6,Nori, Prathi
in my notepad.
error is
NULL
Thanks alot Ahmed.
Iam so happy
thanks alot.
Anujahnavi S
November 26, 2007 at 11:17 pm
So Im happy for you just re-write EXEC master..xp_cmdshell @CmdString, no_output
to not have the output null
Regards,
Ahmed
November 26, 2007 at 11:19 pm
use ">> C:\Save.txt" instead of "> C:\Save.txt"
November 26, 2007 at 11:52 pm
hi Ahmed,
i got it Ahmed thanks alot...................
Iam very very happy.
u know actually even my team lead Din't get this .......... if u dont help me i too will not be getting thanks .........alooooooooooooooooooot
Today party in my cabin for getting this tasks result to a text file.
Thanks Ahmed.....Thanks alot Ahmed.
Please help me in every aspect .i suppose u will .thanks alot thank uuuuuuuuu.
Anujahanvi S.
November 27, 2007 at 10:04 pm
Hi Ahmed,
Y not responding?
ok
If iam hving doubt u will or what.
My TeamLeader said
"hmm Anu Did a Good Job".
All this credit goes to u Ahmed.
This is the first time i got help from a unknown person.Thanks alot.
Will be waiting for ur mail Ahmed.
Anujahnavi S.
November 27, 2007 at 10:39 pm
hi Ahmed,
Thanks alot
My Team Leader Said
"hmm Anu ,U did a Good Job"
I felt happy it's because of u .
Thinking that i dint give any reply back
I was giving mail to the other person by thinking it's u .
Now iam hving other question.
Want to save the whole records in the table to the xml file.
in xml file iam saving the result but whole records iam not getting.
will be waiting for ur reply
Anujahnavi S.
November 28, 2007 at 1:25 am
Hi anujahnavi,
set nocount on
EXEC master.dbo.xp_cmdshell 'bcp "select * from tablefortrigger order by track FOR XML Auto, ELEMENTS, root(''Tracks'')" queryout c:\Result.xml -S. -Uusername -Ppassword -c -r -t', no_output
set nocount off
Regards,
Ahmed
November 28, 2007 at 1:40 am
hi Ahmed,
Can u be a bit clear about this saving to xml file.
What r those
bcp,ELEMENTS,root,-c,-r,-t?
and can the xml file be created when the trigger is fired in sql server express?
In that file result must be placed .can we do this?
Thanks & Regards
Anujahnavi S.
Viewing 15 posts - 16 through 30 (of 55 total)
You must be logged in to reply to this topic. Login to reply