|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Tuesday, June 11, 2013 2:10 PM
Points: 71,
Visits: 238
|
|
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)
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 12:02 PM
Points: 2,581,
Visits: 7,295
|
|
Maybe a version mis-match between Management Studio and the installed version of SQL ?
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 1:07 PM
Points: 6,826,
Visits: 11,951
|
|
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
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Tuesday, June 11, 2013 2:10 PM
Points: 71,
Visits: 238
|
|
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.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 1:07 PM
Points: 6,826,
Visits: 11,951
|
|
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
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Tuesday, June 11, 2013 2:10 PM
Points: 71,
Visits: 238
|
|
opc.three (3/1/2013) Sounds like a bug in SMO.
I agree. ^.^ I'm trying to track it down and fix it hopefully.
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Today @ 4:35 PM
Points: 143,
Visits: 456
|
|
| In addition to job owner, the "run as" of a step may be associated with an invalid SID.
|
|
|
|