SQL - Select substring
Hello!
I need to write a query that selects TableID (a previously concatenated string) and also selects a substring of TableID as another column. All data in TableID is in the format %System.Variable, %Class.User, etc. I need to select from the % to the '.' to return something like %System and %Class respectively. Any suggestions?
Thanks!
Phil
17 Minutes
Discussion Span
10 Months Ago
Last Updated
Related Article: SQL Query For String Searching
is a Databases discussion thread by lhsunshine that has 6 replies, was last updated 5 months ago and has been tagged with the keywords: query, string.
PhilEaton
Junior Poster
119 posts since Aug 2010
Reputation Points: 10
Solved Threads: 1
Skill Endorsements: 1
Got it working!
substring(TableId,1,charindex('.',TableId)-1) AS Package,
PhilEaton
Junior Poster
119 posts since Aug 2010
Reputation Points: 10
Solved Threads: 1
Skill Endorsements: 1
Question Self-Answered as of 10 Months Ago