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

stuff in sql

STUFF Function: This function is used to
overwrite existing character or inserts
a string into another string. 

REPLACE function: This function is used 
to replace the existing characters
of all the occurrences.
Comment

PREVIOUS NEXT
Code Example
Sql :: create fulltext index mysql 
Sql :: SQL SUM() Function 
Sql :: set a value by excuting stored procedure 
Sql :: mysql average from two table 
Sql :: sql recursive query 
Sql :: rename temp table column name in sql server 
Sql :: homebrew mysql service not starting 
Sql :: how to verify sequence result in oracle SQL 
Sql :: rownum in sql 
Sql :: sql update by id 
Sql :: longtext sql 
Sql :: mysql dump structure only 
Sql :: not equal in mysql query 
Sql :: merge command in sql 
Sql :: what is between keyword used for 
Sql :: mariadb cast null to 0 
Sql :: T-SQL and the WHERE LIKE %Parameter% clause 
Sql :: how to install mssql on mac 
Sql :: ms sql check if column is nullable 
Sql :: postgres disable foreign keys 
Sql :: sql timezone 
Sql :: find the names of sailors who have reserved at least one boat 
Sql :: how to left join a sub query in postgresql 
Sql :: sql not 
Sql :: sql datetime functions 
Sql :: group by sql 
Sql :: Why mysql is used? 
Sql :: what is ssrs and ssis in sql server 
Sql :: constraint sql 
Sql :: are both the inserted and deleted tables used in update trigger 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =