Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Strange error, cannot script out jobs from SQL. Expand / Collapse
Author
Message
Posted Thursday, February 28, 2013 12:01 PM


SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Today @ 7:20 AM
Points: 604, Visits: 478
When trying to script out a current job on our MSX sql server, we receive this error,"Unable cast object of type 'system.dbnull' to type 'system.string'. (microsoft.sqlserver.smo)"

I cannot find a lot of information on this topic. what would allow this job to run, yet prevent it from being scripted out and moved to our other MSX server?

It will work on some jobs, just not most of them. I do have SA on the box.


===================================

Script failed for Server '*******'. (Microsoft.SqlServer.Smo)

------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.2500.0+((KJ_PCU_Main).110617-0026+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Script+Server&LinkId=20476

------------------------------
Program Location:

at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyCollection depList, SqlSmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(Urn[] urns, SqlSmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.Script(Urn[] urns, SqlSmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.EnumScript(Urn[] urns)
at Microsoft.SqlServer.Management.Smo.Scripter.Script(Urn[] urns)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ScriptGenerator.ScriptCreate(SqlTextWriter sqlwriter, Server server, Urn[] urns, SqlScriptOptions options)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ScriptNodeActionContext.Script(SqlTextWriter writer)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.SqlScriptMenu.OnScriptItemClick(Object sender, EventArgs e)

===================================

Unable to cast object of type 'System.DBNull' to type 'System.String'. (Microsoft.SqlServer.Smo)

------------------------------
Program Location:

at Microsoft.SqlServer.Management.Smo.Agent.Job.GetJobScriptingScript(StringBuilder createQuery, ScriptingOptions so)
at Microsoft.SqlServer.Management.Smo.Agent.Job.ScriptCreate(StringCollection queries, ScriptingOptions so)
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithListWorker(DependencyCollection depList, SqlSmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyCollection depList, SqlSmoObject[] objects)


.
Post #1425236
Posted Thursday, February 28, 2013 7:16 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Saturday, April 12, 2014 11:40 AM
Points: 2,795, Visits: 8,297
Maybe a version mis-match between Management Studio and the installed version of SQL ?


Post #1425326
Posted Thursday, February 28, 2013 10:36 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 9:25 AM
Points: 7,070, Visits: 12,523
Check the owner of the job(s) in querstion. It may be owned by an SID that does not resolve to a valid login which could be giving SMO heartburn.

SELECT SUSER_SNAME(owner_sid)
FROM msdb.dbo.sysjobs
WHERE name = N'problem_job_name';


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato

Believe you can and you're halfway there. --Theodore Roosevelt

Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein

The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein

1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
Post #1425348
Posted Friday, March 01, 2013 8:48 AM


SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Today @ 7:20 AM
Points: 604, Visits: 478
I tried that just now, it resolves to a good name. I wonder why it states system.dbnull I cannot figure that one out.

These are Multiserver jobs. Though, even when targeted to the current server... it fails to script out.


.
Post #1425558
Posted Friday, March 01, 2013 10:04 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 9:25 AM
Points: 7,070, Visits: 12,523
Sounds like a bug in SMO.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato

Believe you can and you're halfway there. --Theodore Roosevelt

Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein

The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein

1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
Post #1425613
Posted Friday, March 01, 2013 10:35 AM


SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Today @ 7:20 AM
Points: 604, Visits: 478
opc.three (3/1/2013)
Sounds like a bug in SMO.


I agree. ^.^ I'm trying to track it down and fix it hopefully.


.
Post #1425626
Posted Friday, March 01, 2013 3:57 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, March 13, 2014 5:56 PM
Points: 237, Visits: 761
In addition to job owner, the "run as" of a step may be associated with an invalid SID.
Post #1425781
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse