"sqlserver: can we select from comma seperated string variable value" Code Answer's
You're definitely familiar with the best coding language SQL that developers use to develop their projects and they get all their queries like "sqlserver: can we select from comma seperated string variable value" answered properly. Developers are finding an appropriate answer about sqlserver: can we select from comma seperated string variable value related to the SQL coding language. By visiting this online portal developers get answers concerning SQL codes question like sqlserver: can we select from comma seperated string variable value. Enter your desired code related query in the search bar and get every piece of information about SQL code related question on sqlserver: can we select from comma seperated string variable value.
sqlserver: can we select from comma seperated string variable value
/****** Object: UserDefinedFunction [dbo].[CSVToTable] Script Date: 04/28/2013 10:45:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[CSVToTable] (@InStr VARCHAR(MAX))
RETURNS @TempTab TABLE
(id int not null)
AS
BEGIN
;-- Ensure input ends with comma
SET @InStr = REPLACE(@InStr + ',', ',,', ',')
DECLARE @SP INT
DECLARE @VALUE VARCHAR(1000)
WHILE PATINDEX('%,%', @INSTR ) <> 0
BEGIN
SELECT @SP = PATINDEX('%,%',@INSTR)
SELECT @VALUE = LEFT(@INSTR , @SP - 1)
SELECT @INSTR = STUFF(@INSTR, 1, @SP, '')
INSERT INTO @TempTab(id) VALUES (@VALUE)
END
RETURN
END
GO
Source: www.codeproject.com
All those coders who are working on the SQL based application and are stuck on sqlserver: can we select from comma seperated string variable value can get a collection of related answers to their query. Programmers need to enter their query on sqlserver: can we select from comma seperated string variable value related to SQL code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about sqlserver: can we select from comma seperated string variable value for the programmers working on SQL code while coding their module. Coders are also allowed to rectify already present answers of sqlserver: can we select from comma seperated string variable value while working on the SQL language code. Developers can add up suggestions if they deem fit any other answer relating to "sqlserver: can we select from comma seperated string variable value". Visit this developer's friendly online web community, CodeProZone, and get your queries like sqlserver: can we select from comma seperated string variable value resolved professionally and stay updated to the latest SQL updates.