Click here to Skip to main content
15,891,607 members
Home / Discussions / Database
   

Database

 
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 
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 
Trustapple wrote:
It still is not working


Getting and error message?

I think it should be more like (may contain several typos):
select customername,
case 
   when CHARINDEX(',', customername)>0 then
      substring(customername,1,CHARINDEX(',', customername) -1)
   else 
      substring(customername,1,CHARINDEX(' ', customername) -1) 
end as [firstname ],
case 
   when CHARINDEX(',', customername)>0 then
      SUBSTRING(customername, CHARINDEX(',', customername) + 1, LEN(customername)) 
   else 
      SUBSTRING(customername, CHARINDEX(' ', customername) + 1, LEN(customername)) 
end AS [LastName]
from TableName


The need to optimize rises from a bad design.My articles[^]

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 
AnswerRe: Right Outer Joins and performance Pin
Wendelius10-Dec-08 8:54
mentorWendelius10-Dec-08 8:54 
GeneralRe: Right Outer Joins and performance [modified] Pin
dl4gbe10-Dec-08 16:36
dl4gbe10-Dec-08 16:36 
GeneralRe: Right Outer Joins and performance Pin
Wendelius11-Dec-08 5:41
mentorWendelius11-Dec-08 5:41 

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.