Click here to Skip to main content
15,879,613 members
Home / Discussions / Database
   

Database

 
GeneralRe: Uncertain on What to Use as Foreign Key of a Table Pin
PIEBALDconsult30-Oct-14 5:59
mvePIEBALDconsult30-Oct-14 5:59 
AnswerRe: Uncertain on What to Use as Foreign Key of a Table Pin
Eddy Vluggen30-Oct-14 6:08
professionalEddy Vluggen30-Oct-14 6:08 
GeneralRe: Uncertain on What to Use as Foreign Key of a Table Pin
ASPnoob30-Oct-14 6:34
ASPnoob30-Oct-14 6:34 
Questionplsql Pin
Member 1118871528-Oct-14 21:28
Member 1118871528-Oct-14 21:28 
AnswerRe: plsql Pin
Mycroft Holmes28-Oct-14 22:03
professionalMycroft Holmes28-Oct-14 22:03 
GeneralRe: plsql Pin
PhilLenoir29-Oct-14 3:04
professionalPhilLenoir29-Oct-14 3:04 
RantRetrieve Data Using Comma Separated List Pin
ASPnoob28-Oct-14 20:10
ASPnoob28-Oct-14 20:10 
GeneralRe: Retrieve Data Using Comma Separated List Pin
Mycroft Holmes28-Oct-14 22:01
professionalMycroft Holmes28-Oct-14 22:01 
I have a function (every dev does) which splits a string and returns a table with ID and Item, you could then join the split with your data table

SQL
Select *
From Table T
inner join fn_Split(@List,',') l on L.item = T.FieldName




SQL
ALTER   FUNCTION [dbo].[fn_Split]
 (@List  varchar(8000), @Delimiter char(1))

RETURNS @Results table
 (Item varchar(8000),ID int Identity(1,1))

AS

begin
 declare @IndexStart int
 declare @IndexEnd int
 declare @Length  int
 declare @Word  varchar(8000)

 set @IndexStart = 1
 set @IndexEnd = 0

 set @Length = len(@List)
If @Delimiter = '' Set @Delimiter = ','

--Get rid of any tabs or returns
Set @List = Replace(@List,char(9),'')
Set @List = Replace(@List,char(10),'')
Set @List = Replace(@List,char(13),'')

while @IndexStart <= @Length
begin
	set @IndexEnd = charindex(@Delimiter, @List, @IndexStart)
		
	If @Delimiter = char(32) 
		set @IndexEnd = charindex(Space(1), @List, @IndexStart)

	if @IndexEnd = 0
		set @IndexEnd = @Length + 1

	set @Word = substring(@List, @IndexStart, @IndexEnd - @IndexStart)
	set @IndexStart = @IndexEnd + 1

	INSERT INTO @Results(Item)
	SELECT @Word
end

return
end 

Never underestimate the power of human stupidity
RAH

GeneralRe: Retrieve Data Using Comma Separated List Pin
Shweta N Mishra29-Oct-14 1:23
professionalShweta N Mishra29-Oct-14 1:23 
GeneralRe: Retrieve Data Using Comma Separated List Pin
Mycroft Holmes29-Oct-14 3:13
professionalMycroft Holmes29-Oct-14 3:13 
QuestionAdvice on Perfomance Turning of the Query Pin
Vimalsoft(Pty) Ltd28-Oct-14 7:27
professionalVimalsoft(Pty) Ltd28-Oct-14 7:27 
GeneralRe: Advice on Perfomance Turning of the Query Pin
PIEBALDconsult28-Oct-14 8:04
mvePIEBALDconsult28-Oct-14 8:04 
AnswerRe: Advice on Perfomance Turning of the Query Pin
Eddy Vluggen28-Oct-14 8:59
professionalEddy Vluggen28-Oct-14 8:59 
AnswerRe: Advice on Perfomance Turning of the Query Pin
Mycroft Holmes28-Oct-14 12:59
professionalMycroft Holmes28-Oct-14 12:59 
GeneralRe: Advice on Perfomance Turning of the Query Pin
Vimalsoft(Pty) Ltd4-Nov-14 21:56
professionalVimalsoft(Pty) Ltd4-Nov-14 21:56 
QuestionCombine results from 2 foxpro DBF files using union Pin
jkirkerx27-Oct-14 12:30
professionaljkirkerx27-Oct-14 12:30 
AnswerMakes no sense how it works Pin
jkirkerx27-Oct-14 13:01
professionaljkirkerx27-Oct-14 13:01 
QuestionSelect count on 2 DBF files Pin
jkirkerx27-Oct-14 11:11
professionaljkirkerx27-Oct-14 11:11 
GeneralRe: Select count on 2 DBF files Pin
PIEBALDconsult27-Oct-14 11:25
mvePIEBALDconsult27-Oct-14 11:25 
GeneralRe: Select count on 2 DBF files Pin
jkirkerx27-Oct-14 12:23
professionaljkirkerx27-Oct-14 12:23 
QuestionRewrit a Scalar function to a table valued function Pin
Ambertje21-Oct-14 0:00
Ambertje21-Oct-14 0:00 
AnswerRe: Rewrit a Scalar function to a table valued function Pin
Mycroft Holmes21-Oct-14 0:25
professionalMycroft Holmes21-Oct-14 0:25 
GeneralRe: Rewrit a Scalar function to a table valued function Pin
Ambertje21-Oct-14 1:40
Ambertje21-Oct-14 1:40 
GeneralRe: Rewrit a Scalar function to a table valued function Pin
Richard Deeming21-Oct-14 2:00
mveRichard Deeming21-Oct-14 2:00 
GeneralRe: Rewrit a Scalar function to a table valued function Pin
Ambertje21-Oct-14 2:25
Ambertje21-Oct-14 2:25 

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.