Click here to Skip to main content
15,887,821 members
Home / Discussions / Database
   

Database

 
GeneralRe: Multiple Rows to Single Rows Pin
Chris Meech18-Oct-10 4:17
Chris Meech18-Oct-10 4:17 
GeneralRe: Multiple Rows to Single Rows Pin
Alegria_Lee18-Oct-10 4:48
Alegria_Lee18-Oct-10 4:48 
Questionsplitting one column into many Pin
rakeshs31215-Oct-10 0:42
rakeshs31215-Oct-10 0:42 
AnswerRe: splitting one column into many Pin
J4amieC15-Oct-10 1:17
J4amieC15-Oct-10 1:17 
GeneralRe: splitting one column into many Pin
rakeshs31215-Oct-10 2:23
rakeshs31215-Oct-10 2:23 
GeneralRe: splitting one column into many Pin
J4amieC15-Oct-10 2:53
J4amieC15-Oct-10 2:53 
AnswerRe: splitting one column into many Pin
PIEBALDconsult15-Oct-10 3:07
mvePIEBALDconsult15-Oct-10 3:07 
AnswerRe: splitting one column into many Pin
Rajesh Anuhya19-Oct-10 23:57
professionalRajesh Anuhya19-Oct-10 23:57 
Here i am giving a scalar function to active this..,

GO
/****** Object:  UserDefinedFunction [dbo].[SplitGETPosFunc]    Script Date: 10/20/2010 15:22:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[SplitGETPosFunc](@String varchar(8000), 
@Delimiter char(1),
@POSITION INT)
RETURNS varchar(1000)
WITH EXECUTE AS CALLER
AS
begin     
	declare @idx int;     
    DECLARE @CHARIDX INT;
    DECLARE @INPUTSTR VARCHAR(8000);
    declare @OUTPUT varchar(1000);
    SET @INPUTSTR=@String;
    SET @CHARIDX =0;
    SET @idx=0;
    if (substring(@String,1,1)='S')
		begin
			while @idx < @POSITION   
				begin     
				SET @CHARIDX= CHARINDEX(@Delimiter, @INPUTSTR);
				SET @OUTPUT=SUBSTRING(@INPUTSTR, 1, @CHARIDX - 1)
				SET @INPUTSTR = SUBSTRING(@INPUTSTR,@CHARIDX +1,LEN(@INPUTSTR));
				SET @idx=@idx+1;
			end 
		end
	else
	   set @OUTPUT=@String;
return   @OUTPUT;  
end


@String = original string
@Delimiter = delemeter (in your case space)
@POSITION INT = position of the word(starts from 1)


function will return the word in the specified location


Thanks & Regards
Rajesh B
Rajesh B --> A Poor Workman Blames His Tools <--

Questionexesute ssis package Pin
samerh14-Oct-10 3:24
samerh14-Oct-10 3:24 
AnswerRe: exesute ssis package Pin
Vimalsoft(Pty) Ltd14-Oct-10 4:53
professionalVimalsoft(Pty) Ltd14-Oct-10 4:53 
Question1 recursive field in a Query Pin
Herman<T>.Instance14-Oct-10 0:25
Herman<T>.Instance14-Oct-10 0:25 
AnswerRe: 1 recursive field in a Query Pin
Simon_Whale14-Oct-10 0:41
Simon_Whale14-Oct-10 0:41 
AnswerRe: 1 recursive field in a Query Pin
Alegria_Lee14-Oct-10 2:11
Alegria_Lee14-Oct-10 2:11 
GeneralRe: 1 recursive field in a Query Pin
Herman<T>.Instance14-Oct-10 2:20
Herman<T>.Instance14-Oct-10 2:20 
AnswerRe: 1 recursive field in a Query [modified] Pin
Herman<T>.Instance14-Oct-10 2:19
Herman<T>.Instance14-Oct-10 2:19 
GeneralRe: 1 recursive field in a Query Pin
Chris Meech14-Oct-10 3:11
Chris Meech14-Oct-10 3:11 
GeneralRe: 1 recursive field in a Query Pin
Herman<T>.Instance14-Oct-10 3:18
Herman<T>.Instance14-Oct-10 3:18 
GeneralRe: 1 recursive field in a Query Pin
Simon_Whale14-Oct-10 3:43
Simon_Whale14-Oct-10 3:43 
GeneralRe: 1 recursive field in a Query Pin
Herman<T>.Instance14-Oct-10 4:16
Herman<T>.Instance14-Oct-10 4:16 
GeneralRe: 1 recursive field in a Query Pin
Mycroft Holmes14-Oct-10 11:12
professionalMycroft Holmes14-Oct-10 11:12 
GeneralRe: 1 recursive field in a Query [modified] Pin
Herman<T>.Instance17-Oct-10 22:21
Herman<T>.Instance17-Oct-10 22:21 
QuestionSubquery select case Pin
C#Coudou13-Oct-10 15:11
C#Coudou13-Oct-10 15:11 
AnswerRe: Subquery select case Pin
Karthik. A13-Oct-10 15:44
Karthik. A13-Oct-10 15:44 
GeneralRe: Subquery select case [modified] Pin
Alegria_Lee13-Oct-10 16:25
Alegria_Lee13-Oct-10 16:25 
GeneralRe: Subquery select case Pin
Karthik. A13-Oct-10 16:29
Karthik. A13-Oct-10 16:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.