Click here to Skip to main content
15,898,035 members
Home / Discussions / Database
   

Database

 
QuestionError. Pin
bhavnvyas18-Feb-10 23:34
bhavnvyas18-Feb-10 23:34 
AnswerRe: Error. Pin
Richard MacCutchan19-Feb-10 4:03
mveRichard MacCutchan19-Feb-10 4:03 
GeneralRe: Error. Pin
bhavnvyas19-Feb-10 18:20
bhavnvyas19-Feb-10 18:20 
GeneralRe: Error. Pin
nainakarri21-Feb-10 22:29
nainakarri21-Feb-10 22:29 
QuestionPIVOT Pin
Mugdha_Aditya18-Feb-10 22:47
Mugdha_Aditya18-Feb-10 22:47 
AnswerRe: PIVOT Pin
JHizzle18-Feb-10 23:57
JHizzle18-Feb-10 23:57 
AnswerRe: PIVOT Pin
Eddy Vluggen20-Feb-10 6:10
professionalEddy Vluggen20-Feb-10 6:10 
AnswerRe: PIVOT Pin
Niladri_Biswas20-Feb-10 17:42
Niladri_Biswas20-Feb-10 17:42 
Try this

declare @t table(Emp_Name varchar(50))
insert into @t select 'A' union all select 'B' union all select 'C'
union all select 'D' union all select 'E'

Solution 1:
declare @concat varchar(100)
set @concat = ''
select @concat = @concat + Emp_Name + ',' from @t
select Emp_Name =Left(@concat,len(@concat)-1)

Solution 2:
select Emp_Name = RIGHT(delimitedCol,len(delimitedCol)-1) from
(select ',' + CAST(Emp_Name AS varchar(8000))
from @t
for xml path(''))x(delimitedCol)

Output(For both the cases)
Emp_Name
A,B,C,D,E


Even you can use while loop , cursors but the approaches mentioned above are faster enough.
Smile | :)
Niladri Biswas

AnswerRe: PIVOT Pin
nainakarri21-Feb-10 22:20
nainakarri21-Feb-10 22:20 
Questionhow to get the count under different values in the same feilld. Pin
prasadbuddhika18-Feb-10 21:07
prasadbuddhika18-Feb-10 21:07 
AnswerRe: how to get the count under different values in the same feilld. Pin
Mycroft Holmes18-Feb-10 22:41
professionalMycroft Holmes18-Feb-10 22:41 
QuestionAccess2007 - OLE MS Graph Chart, data not shown Pin
john john mackey18-Feb-10 7:28
john john mackey18-Feb-10 7:28 
QuestionTSql , Update master / child records Pin
Hemant Thaker18-Feb-10 1:40
Hemant Thaker18-Feb-10 1:40 
AnswerRe: TSql , Update master / child records Pin
Ashfield18-Feb-10 3:13
Ashfield18-Feb-10 3:13 
QuestionRe: TSql , Update master / child records Pin
Hemant Thaker18-Feb-10 7:04
Hemant Thaker18-Feb-10 7:04 
GeneralRe: TSql , Update master / child records Pin
Hemant Thaker18-Feb-10 7:30
Hemant Thaker18-Feb-10 7:30 
AnswerRe: TSql , Update master / child records Pin
Mycroft Holmes18-Feb-10 11:30
professionalMycroft Holmes18-Feb-10 11:30 
QuestionConditional Sum in SQL Query Pin
Tufail Ahmad17-Feb-10 21:13
Tufail Ahmad17-Feb-10 21:13 
AnswerRe: Conditional Sum in SQL Query Pin
Pranay Rana17-Feb-10 21:23
professionalPranay Rana17-Feb-10 21:23 
AnswerRe: Conditional Sum in SQL Query Pin
Mycroft Holmes17-Feb-10 21:24
professionalMycroft Holmes17-Feb-10 21:24 
AnswerRe: Conditional Sum in SQL Query Pin
Niladri_Biswas20-Feb-10 18:15
Niladri_Biswas20-Feb-10 18:15 
QuestionList products sold to buyers Pin
freshonlineMax17-Feb-10 17:29
freshonlineMax17-Feb-10 17:29 
AnswerRe: List products sold to buyers Pin
_Damian S_17-Feb-10 17:32
professional_Damian S_17-Feb-10 17:32 
GeneralRe: List products sold to buyers Pin
freshonlineMax18-Feb-10 9:38
freshonlineMax18-Feb-10 9:38 
GeneralRe: List products sold to buyers Pin
_Damian S_18-Feb-10 11:59
professional_Damian S_18-Feb-10 11:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.