Nicola Simboli Nicola Simboli data developer, analyst and consultant
  • About Nicola
  • Experience
  • Education
  • Hard skills
  • Soft skills
  • Projects
  • Articles
  • Certifications

  • Coding notes
  • Resources download

  • Credits

Code notes & cookbook

SQL Server

Generic transformation

  • • How to DELETE with JOIN
  • • How to remove duplicate rows from a table
  • • How to drop a temporary table if it exists
  • • How to rename a column of a table
  • • How to UPDATE a table with JOIN
  • • How to count unique values from a column
  • • How to prevent division zero error

String transformation

  • • How extract the left side of a string until a character
  • • How to concatenate names based on the team name
  • • How to concatenate values of a columns into a string

Date and time transformation

  • • How to aggregate periods in SQL Server
  • • How to generate periods of time between two dates
  • • How to convert Excel datetime to SQL datetime and back
  • • Get current DATE or DATETIME

Pivot/unpivot

  • • How to make a pivot table (with fixed columns) in SQL Server
  • • How to make a pivot table (with dynamic columns) in SQL Server
  • • How to unpivot a table in SQL Server

Query system information and structure

  • • How to query the version of SQL Server
  • • How to find numeric columns in a temporary table
  • • How to ADD COLUMN to existing TABLE
  • • How to find all tables with a specified COLUMN
  • • How to find all stored procedures which contains a word in SQL Server
  • • How to add constraints to existing table
  • • How to check if table has rows

Back to the cookbook index page