SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


DBmirroring state change SQL job


DBmirroring state change SQL job

Author
Message
muth_51
muth_51
SSC Eights!
SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)

Group: General Forum Members
Points: 945 Visits: 2905
Hi All,

I have created the sql job refering to the microsoft article.
http://technet.microsoft.com/en-us/library/cc966392.aspx#XSLTsection129121120120

For the step: Record state change
INSERT INTO dbo.[DB Mirroring State Changes] (
[Event Time],
[Event Description],
[New State],
[Database] )
VALUES (
$(WMI(StartTime)),
'$(WMI(TextData))',
$(WMI(State)),
'$(WMI(DatabaseName))' )

I am getting this error message and sql job is failing:

Unable to start execution of step 2 (reason: The job step contains tokens. For SQL Server 2005 Service Pack 1 or later, you must use the appropriate ESCAPE_xxx macro to update job steps containing tokens before the job can run.). The step failed.

Any help is appreciated. Thanks.
Neeraj Dwivedi
Neeraj Dwivedi
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1101 Visits: 1336
Please take a look at :-
http://msdn.microsoft.com/en-us/library/ms175575.aspx
Perry Whittle
Perry Whittle
SSC-Insane
SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)

Group: General Forum Members
Points: 20008 Visits: 17243
Use the appropriate escape macro, if you dont need to escape any quote marks then the following will apply


INSERT INTO dbo.[DB Mirroring State Changes] (
[Event Time],
[Event Description],
[New State],
[Database] )
VALUES (
$(ESCAPE_NONE(WMI(StartTime))),
$(ESCAPE_NONE(WMI(TextData))),
$(ESCAPE_NONE(WMI(State))),
$(ESCAPE_NONE(WMI(DatabaseName))))



-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs" ;-)
muth_51
muth_51
SSC Eights!
SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)

Group: General Forum Members
Points: 945 Visits: 2905
When i execute this statement i am getting the below error message:


INSERT INTO dbo.[DB Mirroring State Changes] (
[Event Time],
[Event Description],
[New State],
[Database] )
VALUES (
$(ESCAPE_NONE(WMI(StartTime))),
$(ESCAPE_NONE(WMI(TextData))),
$(ESCAPE_NONE(WMI(State))),
$(ESCAPE_NONE(WMI(DatabaseName))))

Output:
Msg 102, Level 15, State 1, Line 7
Incorrect syntax near '('.

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search