Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
qman
Constraint Violating Yak Guru
442 Posts |
Posted - 2010-09-07 : 09:04:47
|
I am trying to code and expression which will be used as the Subject line of an email.I have a global variable (var_rowcount) which has a record number assigned to it. If the record number is > 0, I want "PASS, blah blah blah" to display in the emails subject line, otherwise "FAIL, blah blah blah".I am playing around with the below syntax which SSIS does not like, any thoughts?(@[User::var_rowcount] = 0) ? ('PASS') : ('FAIL') |
|
tmitch
Yak Posting Veteran
60 Posts |
Posted - 2010-09-08 : 12:26:04
|
A couple of minor problems... First, the single equal sign is interpreted as an assignment, not a test (much like in C#). You'll need to use the double equals (==) to test for equality.Also, you should use double quotes instead of single quotes around your string literals.Your modified statement would look similar to the following:(@[User::var_rowcount] == 0) ? "PASS" : "FAIL"Hope this helps....---------------------Tim MitchellSQL Server MVPwww.TimMitchell.net |
|
|
qman
Constraint Violating Yak Guru
442 Posts |
Posted - 2010-09-08 : 14:18:47
|
Thank Tim, let me give it a shot. |
|
|
qman
Constraint Violating Yak Guru
442 Posts |
Posted - 2010-09-14 : 07:58:35
|
Hi Tim, worked perfect. Thanks!!! |
|
|
qman
Constraint Violating Yak Guru
442 Posts |
Posted - 2010-09-14 : 08:20:03
|
Any chances you could help me further expand the conditional message?I get a parsing error when trying to save the expression.I know it is somthing related to my use of quotes.....(@[User::var_rowcount] == 0) ? " "Import package FAILED to run! " + "\n\n" + "Time Stamp: " + (DT_WSTR, 1000) GETDATE() + "\n\n" " : "Import package was a SUCCESS!" |
|
|
qman
Constraint Violating Yak Guru
442 Posts |
Posted - 2010-09-14 : 08:54:58
|
Forget it, I got it working..... Yahoo! |
|
|
tmitch
Yak Posting Veteran
60 Posts |
Posted - 2010-09-14 : 22:32:50
|
Glad to help. Post back if you run into any more Expression Language problems.---------------------Tim MitchellSQL Server MVPwww.TimMitchell.net |
|
|
|
|
|
|
|