how to get index of in sql server? Ask Question
By   Adil Shahbaz     24-Apr-2024    2

I have an field with name email like "abcd@abc.com"

I want to get first text of @ which is "abcd" and set it into another field username.

Solutions


Nawab

You get this by using LEFT and CHARINDEX

 

SELECT LEFT('abcd@abc.com, CHARINDEX('@', 'abcd@abc.com') - 1) AS username

10033
Copyright Future Minutes © 2015- 2024 All Rights Reserved.   Terms of Service  |   Privacy Policy |  Contact US|  Pages|  Whats new?
Update on: Dec 20 2023 05:10 PM
03
07

New Messages

George Floyd
  • Edit Post Edit This Post within a Hour
  • Hide Chat Hide This Post
  • Delete Chat If inappropriate Post By Mistake
  • Report Inappropriate Chat
  • 4.5kb
  • Hi James! Please remember to buy the food for tomorrow! I’m gonna be handling the gifts and Jake’s gonna get the drinks
  • Hi James! Please remember to buy the food for tomorrow! I’m gonna be handling the gifts and Jake’s gonna get the drinks
  • Hi James! Please remember to buy the food for tomorrow! I’m gonna be handling the gifts and Jake’s gonna get the drinks