Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by dEX2340

  1. dEX2340

    Using CONVERT in CASE WHEN

    I found it in the meantime. THEN CONVERT(VARCHAR(MAX),volatility,128) else 'NA' end
  2. dEX2340

    Using CONVERT in CASE WHEN

    Thanks for the prompt reply PH. However, if I apply your code I get the value 'NA' for all the fields where I expect a volatility value (e.g. 31.3223501286548).
  3. dEX2340

    Using CONVERT in CASE WHEN

    I have a problem with below SQL code. Error message: "Error converting data type varchar to float." CASE WHEN ... THEN volatility else 'NA' end) as volatility So the field 'volatility' is of datatype 'varchar', while 'NA' is datatype 'float', right? I guess it can be solved by using CONVERT...
  4. dEX2340

    SQL: Select Case when ...

    Great! I got what I need now. SELECT CONVERT(varchar, datepart(day,axiom.market_date)) + '-' + SUBSTRING(CONVERT(varchar,datename(month,axiom.market_date)),1,3) + '-' + CONVERT(varchar,datepart(year,axiom.market_date)) as DATE, Thanks a lot for your help!
  5. dEX2340

    SQL: Select Case when ...

    I found it: SELECT CONVERT(varchar, datepart(day,axiom.market_date)) + '-' + CONVERT(varchar,datename(month,axiom.market_date)) + '-' + CONVERT(varchar,datepart(year,axiom.market_date)) as DATE, The only problem I still have is that the month is the full name, not only 3 characters, e.g...
  6. dEX2340

    SQL: Select Case when ...

    Many thanks! I'm getting there, slowly :-) Now, for the date format. In the table the format of column market_date is yyyy-mm-dd. In the report I need a different format= dd-mmm-yy, e.g. 1-Jan-2012. I've tried using DATEPART, e.g. SELECT DATEPART(d, market_date) + '-' + DATEPART(mm...
  7. dEX2340

    SQL: Select Case when ...

    You are right, I should have better described my problem. There are hundreds of row per market date in the table. I would like only 1 row per market date and several columns for government bond rates, filled with the mid rate.
  8. dEX2340

    SQL: Select Case when ...

    @JarlH: Thanks for the prompt reply. However, this is not what I mean. Problem with your solution is that I get this as report: market_date EURFRGBOND1Y EURFRGBOND2Y 2012-03-14 0.32 0 2012-03-14 0 0 2012-03-14 0 0 2012-03-14 0 0 2012-03-14 0 0...
  9. dEX2340

    SQL: Select Case when ...

    I've tried this: CASE WHEN (rate_code='FR.EUR.GBY.0.0.1') THEN mid else 0 end as EURFRGBOND1Y But I don't want all the 0 values, I only want to report the value per market_date and per rate_code
  10. dEX2340

    SQL: Select Case when ...

    Goal is to select data from a table ec_rates, but some conversion is needed to have the right data/column header in a csv file Please see 2 lines of data from the table and what I would like rate_code market_date bid ask mid FR.EUR.GBY.0.0.1 2012-03-14 0.32 0.32 0.32...

Part and Inventory Search

Back
Top