Microsoft SQL Server Query Features

From KeystoneIntranet
Revision as of 16:20, 27 February 2024 by Chanson (talk | contribs) (→‎trim)
Jump to navigation Jump to search

trim

Commands: trim, ltrim, rtrim The trim commands will trim spaces from the beginning and end of strings.

In older MS SQL you must use ltrim and rtrim together to trim both ends of a string... select rtrim(ltrim(address1)) from Customer

Modern MS SQL allows for just trim... select trim(address1) from Customer

concat

replace

Replace singele quote with 2 single quotes: replace(rtrim(ltrim(NAME)),',') "DRIVER_NAME",

left, right

case

iif

windowing functions

rank

derived queries

Derived queries, fequently seen as a "with" statement... allow for querying queries.