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

Best Practice Expand / Collapse
Author
Message
Posted Thursday, November 8, 2012 6:20 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 6:23 AM
Points: 1,598, Visits: 1,375
Good morning. I just have a quick question for you folks. Do you know if when using a Script task in SSIS, is it best practice to create a local variable to hold a value from a variable created at the package or container level, as opposed to just reading directly from the package/container-level variable? For example, out of scenarios A and B below, which is better/best practices?

A:

MessageBox.Show(Dts.Variables["strErrorDescription"].Value.ToString());

B:

string errDesc = Dts.Variables["strErrorDescription"].Value.ToString();
MessageBox.Show(errDesc);

Thanks...Chris
Post #1382456
Posted Thursday, November 8, 2012 7:23 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, June 27, 2014 12:43 PM
Points: 13,872, Visits: 9,596
I'm accustomed to using the package variable, not a script-local one. But that's habit, not something based on actually comparing efficiency/performance/anything.

- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #1382486
Posted Thursday, November 8, 2012 7:29 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 6:23 AM
Points: 1,598, Visits: 1,375
Thanks for the reply.
Post #1382493
Posted Friday, November 9, 2012 12:33 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 1:42 PM
Points: 13,239, Visits: 11,018
For the sake of readability I use option B. But this is a personal choice.



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1382863
Posted Friday, November 9, 2012 10:02 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 6:23 AM
Points: 1,598, Visits: 1,375
OK...thanks.
Post #1383115
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse