there is a table having two columns no and name
and the data is
1 A
2 B
3 C
write a query that will result a horizontal output
A,B,C
Answer Posted / rajesh.a
declare @res varchar(max)
set @res=''
select @res=@res+name+',' from table
select @res=substring(@res,1,len-1)
print @res
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is msdb database? : SQL Server Architecture
What is the meaning of sql server?
1.what is the diff between nolock optimizer and read uncommitted isolation? 2.what is the diff between revoke and deny? 3.what is percieved down time? 4.whether password protection are required for backups?if yes why?if no why? 5.what is fill factor? 6.what is cost analysis? 7.what is mean by piece meal restore? 8.what is 'rowguidcol'? 9.impersonate permission? 10.what is selectivity?
What are different backups available in sql server?
If the job running very slow what is the action you do
Can a table have 2 foreign keys?
What is failover clustering overview?
What is the difference between implicit and explicit transaction?
Write a code to select distinct records without using the DISTINCT keyword.
What is the server name in sql server?
Explain what is the purpose of sql profiler in sql server?
How to create user messages with print statements in ms sql server?
Explain the working of sql privileges?
What is a raid and what are different types of raid configurations?
How to remove duplicate rows from table except one?