Guest User

Untitled

a guest
Jul 23rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. Table: supplier_contacts
  2. contact_id INT IDENTITY(1,1)
  3. first_name VARCHAR(50) NOT NULL,
  4. last_name VARCHAR(50) NULL,
  5. supplier_id INT
  6.  
  7. Database:
  8. first_name = John
  9. last_name = DOe
  10.  
  11. VB.Net:
  12. name = "John Doe"
  13.  
  14. DECLARE @Contact VARCHAR(150) --Value for the full contact name
  15. DECLARE @ContactID INT
  16.  
  17. SELECT @ContactID = contact_id
  18. FROM supplier_contacts
  19. WHERE first_name = SUBSTRING(@Contact, 1, CHARINDEX(' ', @Contact) - 1) AND
  20. last_name = SUBSTRING(@Contact, CHARINDEX(' ', @Contact) + 1, LEN(@Contact))
Add Comment
Please, Sign In to add comment