query

  • Select max volume sql query

    Credits: http://rextester.com/GGOCWB28059 Continue reading

  • SQL splitting columns into multiple

    Useful: select case CHARINDEX(‘_’, name) when 0 then name else SUBSTRING(name, 1, CHARINDEX(‘_’, name) – 1) end firstName, case CHARINDEX(‘_’, name) when 0 then name else SUBSTRING(name, CHARINDEX(‘_’, name) + 1, LEN(name)) end lastname from emp select parsename(replace(yourcolumn,’ ‘,’.’),3) as first, parsename(replace(yourcolumn,’ ‘,’.’),2) as second, parsename(replace(yourcolumn,’ ‘,’.’),1) as third from table Credits: https://stackoverflow.com/questions/22652225/how-to-split-one-column-into-two-columns-in-sql-server http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=167179 Continue reading

Design a site like this with WordPress.com
Get started