The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
TEST
By Guest on 15th May 2019 10:58:04 AM | Syntax: TEXT | Views: 2



New paste | Download | Show/Hide line no. | Copy text to clipboard
  1. ALTER PROCEDURE split
  2.         @kata2 varchar(100)
  3. AS
  4. DECLARE @result table(
  5.         kata2 varchar(100)
  6. )
  7. DECLARE @start int,@end int
  8.         SET @start = 1
  9.         SET @end = CHARINDEX(',',@kata2)
  10.         WHILE (@start<LEN(@kata2)+1)
  11.         BEGIN
  12.                 IF(@end=0)
  13.                 BEGIN
  14.                         SET @end = LEN(@kata2)+1
  15.                 END
  16.                 INSERT INTO @result
  17.                 SELECT
  18.                         SUBSTRING(@kata2,@start,@end-@start)
  19.                 SET @start=@end+1
  20.                 SET @end = CHARINDEX(',',@kata2,@start)
  21.         END
  22. SELECT *
  23. FROM @result
  24.  
  25.  
  26. EXEC split 'abc,defgh,z,er'



  • Recent Pastes