Apr 9, 2003 #1 teksecrets MIS Joined Jan 23, 2003 Messages 26 Location US HI, What is the syntax in SQL to select part of an email address? example: testing@abcd.com How would I create a SQL select statement to only select "testing" and not abcd.com. Any help would be appreciated. Thanks.
HI, What is the syntax in SQL to select part of an email address? example: testing@abcd.com How would I create a SQL select statement to only select "testing" and not abcd.com. Any help would be appreciated. Thanks.
Apr 9, 2003 #2 sunila7 Technical User Joined Apr 11, 2001 Messages 1,087 Location US Hi, Try this select Substring(fldname,1,charindex('@',fldname)-1) from tbl Sunil Upvote 0 Downvote
Apr 9, 2003 Thread starter #3 teksecrets MIS Joined Jan 23, 2003 Messages 26 Location US Thanks, but I get this error: Server: Msg 536, Level 16, State 4, Line 1 Invalid length parameter passed to the substring function. Upvote 0 Downvote
Thanks, but I get this error: Server: Msg 536, Level 16, State 4, Line 1 Invalid length parameter passed to the substring function.
Apr 9, 2003 #4 sunila7 Technical User Joined Apr 11, 2001 Messages 1,087 Location US Hi, do u have NULL or blank fields in the table is yes try this select Substring(fldname,1,charindex('@',fldname)-1) from tbl where fldname is not null and fldname<> '' Sunil Upvote 0 Downvote
Hi, do u have NULL or blank fields in the table is yes try this select Substring(fldname,1,charindex('@',fldname)-1) from tbl where fldname is not null and fldname<> '' Sunil
Apr 10, 2003 #5 JamesLean Programmer Joined Dec 13, 2002 Messages 3,059 Location GB I would check that the address actually contained the @ symbol as this is what is causing the error: Code: select Substring(fldname,1,charindex('@',fldname)-1) from tbl where fldname LIKE '%@%' --James Upvote 0 Downvote
I would check that the address actually contained the @ symbol as this is what is causing the error: Code: select Substring(fldname,1,charindex('@',fldname)-1) from tbl where fldname LIKE '%@%' --James