As for the sp_executesql this internal sql server procedure basically runs every single sql command received by the server. So yes, internally it is always added.
Showing posts with label text. Show all posts
Showing posts with label text. Show all posts
Friday, March 30, 2012
If i am using SqlCommand Class and the CommandType of it is Text, then will it add "sp_exe
If i am using SqlCommand Class and the CommandType of it is Text, then will it add "sp_executesql N" in front of the sql command automatically in fact, just like SqlDataAdapter?If you are using a CommandType of Text, just send the SELECT, INSERT, UPDATE or DELETE command. If you are using CommandType of StoredProcedure, just send the name of the stored procedure. To see exactly what is sent to the SQL Server, use SQL Profiler, which will allow you to capture the exact code sent, which will vary based upon whether you are using parameters, etc.|||that's means i still need to add "sp_executesql N" when i use SqlCommand class and CommandType is Text if i want a better performance?|||As Douglas already suggested if you are not using a stored procedure then use command type text otherwise you should generally use command type stored procedure. You can however still use command type text to run a stored procedure whch does not return records, to do this it would be: "exec procname arg1, arg, arg..."
Labels:
automatically,
class,
command,
commandtype,
database,
microsoft,
mysql,
oracle,
server,
sp_exe,
sp_executesql,
sql,
sqlcommand,
text
IF function that outputs text with embedded formulas
Hello,
I am trying to use this if function in my report, but the imbedded variables are not showing the data they are linked to.
ie - it says {@.FX Currency} instead of EURO
I tried moving the quotes around, but it did not help. Any assistance is appreciated.
if {@.Hedge Des} = "Cash Flow"
then
"To offset changes in the spot price of {@.FX Currency}. This is accomplished by {@.Buy or Sell}ing {@.FX Currency} forward and excluding the forward points from the hedge effectiveness assessment."
else
"To offset changes in the spot price of {@.FX Currency}. This is accomplished by {@.Buy or Sell}ing {@.FXCurrency} forward, with the notional value of the hedge equal to the principal value of the loan."try this:
if {@.Hedge Des} = "Cash Flow"
then
"To offset changes in the spot price of "&{@.FX Currency}&". This is accomplished by "&{@.Buy or Sell}&"ing "&{@.FX Currency}&" forward and excluding the forward points from the hedge effectiveness assessment."
else
"To offset changes in the spot price of "&{@.FX Currency}&". This is accomplished by "&{@.Buy or Sell}&"ing "&{@.FXCurrency}&" forward, with the notional value of the hedge equal to the principal value of the loan."|||Worked like a charm! Thanks so much!
I am trying to use this if function in my report, but the imbedded variables are not showing the data they are linked to.
ie - it says {@.FX Currency} instead of EURO
I tried moving the quotes around, but it did not help. Any assistance is appreciated.
if {@.Hedge Des} = "Cash Flow"
then
"To offset changes in the spot price of {@.FX Currency}. This is accomplished by {@.Buy or Sell}ing {@.FX Currency} forward and excluding the forward points from the hedge effectiveness assessment."
else
"To offset changes in the spot price of {@.FX Currency}. This is accomplished by {@.Buy or Sell}ing {@.FXCurrency} forward, with the notional value of the hedge equal to the principal value of the loan."try this:
if {@.Hedge Des} = "Cash Flow"
then
"To offset changes in the spot price of "&{@.FX Currency}&". This is accomplished by "&{@.Buy or Sell}&"ing "&{@.FX Currency}&" forward and excluding the forward points from the hedge effectiveness assessment."
else
"To offset changes in the spot price of "&{@.FX Currency}&". This is accomplished by "&{@.Buy or Sell}&"ing "&{@.FXCurrency}&" forward, with the notional value of the hedge equal to the principal value of the loan."|||Worked like a charm! Thanks so much!
Monday, March 26, 2012
If Else
All,
looking for help with outputting different text value into a cell.
e.g. a column of a table will only ever have two values, Y & N.
I am looking to populate a CELL within SSRS with Yes or No using a seperate Dataset.
SELECT 'Yes' AS [LookupValue], 'Y' AS LookupCode UNION
SELECT 'No', 'N'
This gives me my two column to lookup which is what I want. However, i need this to populate a cell with Yes instead of Y.
I have tried using it as a parameter but to no avail.
Anyone got any ideas?
Duncan,
Have you tried using the Switch statement instead?
=Switch(Fields!LookUpCode.Value = "Y", "Yes", Fields!LookUpCode.Value = "N", "No")
Hope this helps.
Jarret
Subscribe to:
Posts (Atom)