Search
 
SCRIPT & CODE EXAMPLE
 

SQL

Get the First and Last Word from a String or Sentence

DECLARE @Sentence    VARCHAR(MAX) = 'The quick brown fox jumps over the lazy dog'

SELECT SUBSTRING(@Sentence, 1, CHARINDEX(' ', @Sentence) - 1) AS [First Word],
       REVERSE(SUBSTRING(REVERSE(@Sentence), 1,                CHARINDEX(' ', REVERSE(@Sentence)) - 1)) AS [Last Word]
Comment

PREVIOUS NEXT
Code Example
Sql :: utiliser sql ligne de commande 
Sql :: insert random values in rows postgres 
Sql :: select from where 
Sql :: sql server and spring boot api 
Sql :: normalization in database 2nd normal form 
Sql :: is there any limit of using joins in single mysql query ? 
Sql :: how to check if there is no database schema 
Sql :: update values in select statement sql 
Sql :: sql compound operators 
Sql :: mysql start of today 
Sql :: How to query data in many to many relationship in flask sql alchemy 
Sql :: float in sql 
Sql :: how to fetch first 10 rows in sql 
Sql :: mysql join 
Sql :: mysql 
Sql :: sql select all from one table and one column from another 
Sql :: how to use db.execute 
Sql :: why do we need data structure in sql 
Sql :: check if mysql db is used 
Csharp :: unity next scene 
Csharp :: unity if in editor 
Csharp :: c# word randomizer 
Csharp :: how to lerp in c# 
Csharp :: void on trigger enter 2d 
Csharp :: Debug raycasthit2d unity 
Csharp :: unity foreach dictionary 
Csharp :: print out a dictionary c# 
Csharp :: c# datagridview clear all rows 
Csharp :: add two numbers in c# 
Csharp :: unity change play mode color 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =