How to split comma delimited string in SQL Server 2008?

Step 1: Create a function that will accept the "text string" and "character" where we want to split the string:ALTER FUNCTION [dbo].[funSplit] ( @Texto varchar(max), @Splitter varchar(3) ) RETURNS @Lista TABLE ( rowData varchar(8000) ) AS BEGIN DECLARE @Pos Smallint While len(@Texto)>0 BEGIN

Read More

How to update XML data in SQL Server 2008 using stored procedure?

Step 1:Create a stored procedure that would take the input as XML data  & then break down the data to columns depending upon the XML tags formed: CREATE PROC spExtractDataFromXML (  @inputXML XML='' ) AS BEGIN SET NOCOUNT ON;   SELECT

Read More

How to find duplicate characters in a string in SQL Server?

Below is the query that you can use in-order to get a character count from a string: --Declared a table variable that will act as a temp table to hold the values DECLARE @tbl_char TABLE (input VARCHAR(100),letter VARCHAR(1),remainder VARCHAR(100)) --SET

Read More

Pages (7)« 1234567 »