Column Result to varchar?

  • Hi all.  I had seen an article a while back showing how to return the contents of a column in the results of a query into a variable (like varchar).  I can not seem to find that example again, and I really need to use it.

    Any ideas?

    Thanks.

    Jeff

  • I do not recall this, What are you trying to do?

    Declare @String varchar(8000)

    set @String = ''

    Select @String = @String + mycolumn + ','

    from Mytable

    Something like this?

     

  • Like this?

    SET @MyVar = (Select name from Employees where EmpID = @EmpID)

  • Ray,

    That's what I was looking for.

    Thanks!

    Jeff

  • Next time you search, try the keyword concatenation. It should give you all the answers you need.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply