Click here to Skip to main content
15,892,059 members
Home / Discussions / Database
   

Database

 
AnswerRe: Mirror changed DataTable to old DataTable (ADO.NET) Pin
Wendelius10-Dec-08 10:39
mentorWendelius10-Dec-08 10:39 
GeneralRe: Mirror changed DataTable to old DataTable (ADO.NET) Pin
David Hovey10-Dec-08 11:15
David Hovey10-Dec-08 11:15 
GeneralRe: Mirror changed DataTable to old DataTable (ADO.NET) Pin
Wendelius10-Dec-08 11:25
mentorWendelius10-Dec-08 11:25 
GeneralRe: Mirror changed DataTable to old DataTable (ADO.NET) Pin
David Hovey10-Dec-08 11:31
David Hovey10-Dec-08 11:31 
GeneralRe: Mirror changed DataTable to old DataTable (ADO.NET) Pin
Wendelius10-Dec-08 11:45
mentorWendelius10-Dec-08 11:45 
GeneralRe: Mirror changed DataTable to old DataTable (ADO.NET) Pin
David Hovey10-Dec-08 18:28
David Hovey10-Dec-08 18:28 
GeneralRe: Mirror changed DataTable to old DataTable (ADO.NET) Pin
Wendelius11-Dec-08 4:23
mentorWendelius11-Dec-08 4:23 
QuestionSQL case function to check for charindex as '' or ',' Pin
Trustapple10-Dec-08 8:17
Trustapple10-Dec-08 8:17 
Hello Friends,

I wrote a query for a purpose like this;I have a field by name "CustomerName".I want it to be split as FirstName and LastName as shown below:

CustomerName FirstName LastName

Jack Daniels Jack Daniels
Jack,Daniels Jack Daniels

My query looks like this;

select substring(customername,1,CHARINDEX(',', customername) -1) as [firstname ],
SUBSTRING(customername, CHARINDEX(',', customername) + 1, LEN(customername)) AS [LastName]

from TableName



My Problem is i have two conditions the splitter could be "," or "" in the customername field

I need to integrate this conditions to my query either using "case" or "iif".
ie if the charindex is " " do this and if the charindex is ", " do this


I am not sure how i can do this.Any help is welcome
AnswerRe: SQL case function to check for charindex as '' or ',' Pin
Wendelius10-Dec-08 8:29
mentorWendelius10-Dec-08 8:29 
GeneralRe: SQL case function to check for charindex as '' or ',' Pin
Trustapple10-Dec-08 8:48
Trustapple10-Dec-08 8:48 
GeneralRe: SQL case function to check for charindex as '' or ',' [modified] Pin
Wendelius10-Dec-08 8:58
mentorWendelius10-Dec-08 8:58 
GeneralRe: SQL case function to check for charindex as '' or ',' Pin
Trustapple10-Dec-08 9:35
Trustapple10-Dec-08 9:35 
GeneralRe: SQL case function to check for charindex as '' or ',' Pin
Wendelius10-Dec-08 9:41
mentorWendelius10-Dec-08 9:41 
GeneralRe: SQL case function to check for charindex as '' or ',' Pin
Trustapple10-Dec-08 18:58
Trustapple10-Dec-08 18:58 
GeneralRe: SQL case function to check for charindex as '' or ',' Pin
Trustapple10-Dec-08 19:00
Trustapple10-Dec-08 19:00 
GeneralRe: SQL case function to check for charindex as '' or ',' Pin
Ben Fair10-Dec-08 9:40
Ben Fair10-Dec-08 9:40 
GeneralRe: SQL case function to check for charindex as '' or ',' Pin
Wendelius10-Dec-08 9:52
mentorWendelius10-Dec-08 9:52 
GeneralRe: SQL case function to check for charindex as '' or ',' Pin
Ben Fair10-Dec-08 10:06
Ben Fair10-Dec-08 10:06 
GeneralRe: SQL case function to check for charindex as '' or ',' [modified] Pin
Trustapple10-Dec-08 19:02
Trustapple10-Dec-08 19:02 
GeneralRe: SQL case function to check for charindex as '' or ',' Pin
Wendelius11-Dec-08 4:07
mentorWendelius11-Dec-08 4:07 
GeneralRe: SQL case function to check for charindex as '' or ',' Pin
Trustapple11-Dec-08 18:03
Trustapple11-Dec-08 18:03 
GeneralRe: SQL case function to check for charindex as '' or ',' Pin
Wendelius12-Dec-08 4:19
mentorWendelius12-Dec-08 4:19 
QuestionRight Outer Joins and performance Pin
dl4gbe10-Dec-08 6:38
dl4gbe10-Dec-08 6:38 
GeneralRe: Right Outer Joins and performance Pin
Hesham Amin10-Dec-08 8:09
Hesham Amin10-Dec-08 8:09 
AnswerRe: Right Outer Joins and performance Pin
Jörgen Andersson10-Dec-08 8:35
professionalJörgen Andersson10-Dec-08 8:35 

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.