none
SSRS Left or Right Function

    Question

  • I have can I take one fields characters untill a specified character. For example, I have ID numbers as 

    211-458

    12-58964

    1877-25

    But, I want to take the numbers which are until "-".  Which means 211 , 12, 1877.  How can I solve ?

                  

    Monday, February 04, 2013 1:40 PM

Answers

  • hi,

    Use the split function. It will split your string into two and you can get the first part like this

    =Split("211-458","-")(0)

    =Split("12-58964","-")(0)

    =Split("1877-25","-")(0)


    Please mark as answered or vote helpful if this post help resolved your issue. Thanks!

    k r o o t z

    • Marked as answer by Omnipotent06 Monday, February 04, 2013 1:50 PM
    Monday, February 04, 2013 1:48 PM

All replies

  • select left(col,charindex('-',col))

    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Blog: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance

    • Marked as answer by Omnipotent06 Monday, February 04, 2013 1:50 PM
    • Unmarked as answer by Omnipotent06 Monday, February 04, 2013 1:50 PM
    Monday, February 04, 2013 1:46 PM
  • hi,

    Use the split function. It will split your string into two and you can get the first part like this

    =Split("211-458","-")(0)

    =Split("12-58964","-")(0)

    =Split("1877-25","-")(0)


    Please mark as answered or vote helpful if this post help resolved your issue. Thanks!

    k r o o t z

    • Marked as answer by Omnipotent06 Monday, February 04, 2013 1:50 PM
    Monday, February 04, 2013 1:48 PM
  • Thank you Krootz. Also, I have applied this solution that code and it has worked. 

    =Mid(Fields!FAKTURANUMMER.Value,1,InStr(Fields!FAKTURANUMMER.Value,"-")-1)

    Kroos I have another question. May I ask in here or shall I open a new question?

    Thank you.

    Monday, February 04, 2013 1:49 PM
  • please open a new one so others can answer if I can't. thx.

    Please mark as answered or vote helpful if this post help resolved your issue. Thanks!

    k r o o t z

    Monday, February 04, 2013 1:52 PM