Search
 
SCRIPT & CODE EXAMPLE
 

SQL

stuff in sql server

DECLARE @Table1 TABLE(ID INT, Value INT)
INSERT INTO @Table1 VALUES (1,100),(1,200),(1,300),(1,400)

SELECT  ID
       ,STUFF((SELECT ', ' + CAST(Value AS VARCHAR(10)) [text()]
         FROM @Table1 
         WHERE ID = t.ID
         FOR XML PATH(''), TYPE)
        .value('.','NVARCHAR(MAX)'),1,1,' ') List_Output
FROM @Table1 t
GROUP BY ID
Comment

stuff sql server

SELECT  STUFF(( SELECT  ',' + Lure
                FROM    ( SELECT DISTINCT
                                    Lure
                          FROM      #LureNames
                        ) x
              FOR
                XML PATH('')
              ), 1, 1, '') AllLures
Comment

stuff in sql server

STUFF(string, start, length, new_string)
SELECT STUFF('SQL Tutorial', 1, 5, 'HTML');
-- output
-- HTMLutorial
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql query to find duplicate records 
Sql :: default value false mysql 
Sql :: select database in mysql 
Sql :: SQL SELECT DISTINCT Statement 
Sql :: order by ip address sql 
Sql :: json_value oracle 
Sql :: mysql timezone 
Sql :: ERROR 1064 (42000) 
Sql :: postgresql concat string with separator 
Sql :: what is a unique key in sql 
Sql :: Write an SQL query to fetch worker names with salaries = 50000 and <= 100000. 
Sql :: add foreign key to existing table 
Sql :: truncate table sqlite 
Sql :: check if word is in column sql 
Sql :: sql duplicate a table with data 
Sql :: call function in query sql server 
Sql :: sql compiler online 
Sql :: sql primary key constraint 
Sql :: sql alter column 
Sql :: sql mode 
Sql :: multiple order by sql 
Sql :: mysql 5.6 hierarchical recursive query 
Sql :: select other columns with distinct 
Sql :: copy from one table to another postgres using matching column 
Sql :: show specific events on mysql 
Sql :: mysql date_format 
Sql :: convert negative to positive in sql 
Sql :: sql rename column in select 
Sql :: devilbox mysqldump 
Sql :: intersect sql 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =