Click here to Skip to main content
15,867,834 members
Home / Discussions / Database
   

Database

 
GeneralRe: SQL Transactions - Torn apart in old code Pin
HobbyProggy5-Jul-16 1:56
professionalHobbyProggy5-Jul-16 1:56 
QuestionTime calculation Pin
AVPRF4-Jul-16 20:37
AVPRF4-Jul-16 20:37 
AnswerRe: Time calculation Pin
Mycroft Holmes4-Jul-16 21:01
professionalMycroft Holmes4-Jul-16 21:01 
GeneralRe: Time calculation Pin
AVPRF5-Jul-16 19:47
AVPRF5-Jul-16 19:47 
GeneralRe: Time calculation Pin
Mycroft Holmes6-Jul-16 12:40
professionalMycroft Holmes6-Jul-16 12:40 
GeneralRe: Time calculation Pin
AVPRF6-Jul-16 19:02
AVPRF6-Jul-16 19:02 
QuestionHow to Search for names in MySQL Pin
Jassim Rahma2-Jul-16 13:06
Jassim Rahma2-Jul-16 13:06 
AnswerRe: How to Search for names in MySQL Pin
Mycroft Holmes2-Jul-16 14:10
professionalMycroft Holmes2-Jul-16 14:10 
I don't know about MySQL but in SQL Server I have done the following in the past.

Build a function that takes a string and splits it on a delimiter (space) and return a table.
In your query left outer join the function, passing in your name field, on your name field with Name = or LIKE '%' + itemFromFunction + '%'

Make the result set DISTINCT.

Not sure if = or like is needed in the LOJ.

This is an old SQL Server split function I dug up.
SQL
<pre>
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

QuestionNeed guidance: duplicate oracle db to another Pin
Foothill30-Jun-16 10:48
professionalFoothill30-Jun-16 10:48 
AnswerRe: Need guidance: duplicate oracle db to another Pin
Chris Quinn30-Jun-16 21:26
Chris Quinn30-Jun-16 21:26 
GeneralRe: Need guidance: duplicate oracle db to another Pin
Jörgen Andersson30-Jun-16 22:02
professionalJörgen Andersson30-Jun-16 22:02 
GeneralRe: Need guidance: duplicate oracle db to another Pin
Foothill1-Jul-16 3:16
professionalFoothill1-Jul-16 3:16 
AnswerRe: Need guidance: duplicate oracle db to another Pin
Jörgen Andersson30-Jun-16 22:21
professionalJörgen Andersson30-Jun-16 22:21 
GeneralRe: Need guidance: duplicate oracle db to another Pin
Foothill1-Jul-16 3:14
professionalFoothill1-Jul-16 3:14 
GeneralRe: Need guidance: duplicate oracle db to another Pin
Jörgen Andersson1-Jul-16 6:11
professionalJörgen Andersson1-Jul-16 6:11 
QuestionDB backup initiated by NT AUTHORITY\SYSTEM Pin
SreeDBA24-Jun-16 10:07
SreeDBA24-Jun-16 10:07 
Rant[REPOST] DB backup initiated by NT AUTHORITY\SYSTEM Pin
Richard Deeming27-Jun-16 3:58
mveRichard Deeming27-Jun-16 3:58 
QuestionDatabase backed up type virtual device- not mainteance job Pin
SreeDBA24-Jun-16 10:04
SreeDBA24-Jun-16 10:04 
Rant[REPOST] Database backed up type virtual device- not mainteance job Pin
Richard Deeming27-Jun-16 3:56
mveRichard Deeming27-Jun-16 3:56 
Questioncall sql scripts from others folders Pin
MrKBA19-Jun-16 23:43
MrKBA19-Jun-16 23:43 
QuestionRe: call sql scripts from others folders Pin
CHill6020-Jun-16 1:41
mveCHill6020-Jun-16 1:41 
AnswerRe: call sql scripts from others folders Pin
MrKBA20-Jun-16 2:30
MrKBA20-Jun-16 2:30 
AnswerRe: call sql scripts from others folders Pin
Eddy Vluggen20-Jun-16 1:46
professionalEddy Vluggen20-Jun-16 1:46 
GeneralRe: call sql scripts from others folders Pin
MrKBA20-Jun-16 2:29
MrKBA20-Jun-16 2:29 
GeneralRe: call sql scripts from others folders Pin
Eddy Vluggen20-Jun-16 2:40
professionalEddy Vluggen20-Jun-16 2:40 

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.