Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. concat multi rows field

concat multi rows field

Scheduled Pinned Locked Moved Database
tutorial
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sepel
    wrote on last edited by
    #1

    Hi. I want to concat some row field in a string. for example its my view name id ---- --- RRR 3 eee 1 ddd 3 i want to pass the id "3" to my function and get the "RRR ddd" as my result.

    sepel

    W 1 Reply Last reply
    0
    • S sepel

      Hi. I want to concat some row field in a string. for example its my view name id ---- --- RRR 3 eee 1 ddd 3 i want to pass the id "3" to my function and get the "RRR ddd" as my result.

      sepel

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      You don't say what's your problem exactly. Create a function where id is passed as parameter and varchar as return type. In the function you fetch and concatenate the strings. Refer to CREATE FUNCTION (Transact-SQL)[^].

      The need to optimize rises from a bad design. My articles[^]

      S 1 Reply Last reply
      0
      • W Wendelius

        You don't say what's your problem exactly. Create a function where id is passed as parameter and varchar as return type. In the function you fetch and concatenate the strings. Refer to CREATE FUNCTION (Transact-SQL)[^].

        The need to optimize rises from a bad design. My articles[^]

        S Offline
        S Offline
        sepel
        wrote on last edited by
        #3

        Tank you.

        Mika Wendelius wrote:

        In the function you fetch and concatenate the strings

        My problem is That function. How i should Fetch rows?

        sepel

        W 1 Reply Last reply
        0
        • S sepel

          Tank you.

          Mika Wendelius wrote:

          In the function you fetch and concatenate the strings

          My problem is That function. How i should Fetch rows?

          sepel

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #4

          Create a cursor, open it and loop through it. See: DECLARE CURSOR (Transact-SQL)[^].

          The need to optimize rises from a bad design. My articles[^]

          S 1 Reply Last reply
          0
          • W Wendelius

            Create a cursor, open it and loop through it. See: DECLARE CURSOR (Transact-SQL)[^].

            The need to optimize rises from a bad design. My articles[^]

            S Offline
            S Offline
            sepel
            wrote on last edited by
            #5

            tnx. i try it.

            sepel

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups