Just a Day in the Office
Stuff about applications and databases
Menu Close
  • Home
  • Vertica Kit
  • About Me
  • Dilbert

SQL Server

0

Split comma separated name (last, first)

Posted on July 24, 2012 by Norbert Krupa

The following example will return two columns (first name, last name) based on a single, concatenated, comma separated name. table —— name —— Chin, Cheryl Frank, Robert SELECT RIGHT([name], LEN([name]) – CHARINDEX(’,’, [name]) – 1) AS [first], LEFT([name], CHARINDEX(’,’, [name])-1)… Continue Reading →

SQL Server, String, T-SQL
0

Errors for columns with alias

Posted on July 20, 2012 by Norbert Krupa

You may receive the following errors if you incorrectly alias your column names: Invalid column name No column was specified Check to make sure that your column names are encased in brackets and are not encased by quotes. Incorrect SELECT… Continue Reading →

SQL Server, T-SQL
0

Simple string splitting for insertion

Posted on July 9, 2012 by Norbert Krupa

1 2 3 4 5 6 7 8 DECLARE @string varchar(50), @execSql varchar(1000) SET @string = ‘I like kittens’   SET @execSql = ‘INSERT INTO table (column) SELECT ”’ SET @execSql = @execSql + REPLACE(@string, ‘ ‘, ”’ UNION ALL… Continue Reading →

SQL Server, T-SQL
0

Simple function for comparing software versions

Posted on July 6, 2012 by Norbert Krupa

Traditional arithmetic would tell you that 5.1 = 5.10. However, arithmetic can’t compare software versions such as 5.1 to 5.10, since 5.10 is the ‘newer’ version. The function below receives two version numbers and returns which of the two is… Continue Reading →

function, SQL Server, T-SQL
0

CROSS APPLY for function execution

Posted on June 28, 2012 by Norbert Krupa

The APPLY operator is similar to the JOIN operator, however it specifically allows you to use table functions with parameters to join the results. table1 column —— a1 a2 a3 a4 a5 Using the query below, CROSS APPLY will join… Continue Reading →

SQL Server, T-SQL
0

Calculate percent change between 2 rows in SQL Server using CTE

Posted on June 20, 2012 by Norbert Krupa

A common table expression (CTE) is used in this example to create a temporary result set with a sequential number that allows us to do the arithmetic required to calculate percent change.

common table expressions, function, percent change, SQL Server
0

Select columns for a table in SQL Server

Posted on June 18, 2012 by Norbert Krupa

To select the columns in a specified table in SQL Server, use this code: SELECT c.name FROM sys.columns c, sys.tables t WHERE t.name = ‘table_name’ AND c.object_id = t.object_id

SQL Server
0

Decimal data type precision on SQL Server

Posted on June 5, 2012 by Norbert Krupa

The MSDN article on decimal and numeric data types explains that precision in the decimal data type is the: …total number of decimal digits that can be stored, both to the left and to the right of the decimal point.… Continue Reading →

SQL Server
0

Indexes with Included Columns on SQL Server

Posted on May 10, 2012 by Norbert Krupa

I came across a question on Stack Overflow in which an individual asked what using INCLUDE with your INDEX does.

SQL Server
2

Improving SQL Server Large Table Performance

Posted on May 8, 2012 by Norbert Krupa

Recently I encountered a table of astronomic size. The table is 27.7 GB with ~32.8 million rows. The table only had a single index and the query (below) fetches 4 columns using 3 aggregates filtering the last 6 months from… Continue Reading →

SQL Server

Post navigation

Newer Articles

Connect

Official Seal

Official Seal

Recent Posts

  • Installing Gitblit on CentOS
  • Windows Authentication for SQL Server Connection
  • Canceling FreedomPop Premier Service
  • Bootable Windows 8 USB Drive
  • Resolving javaw.exe is not recognized With Squirrel SQL Client

Resources

  • EXPLAIN Extended
  • Fundamental differences between hashing and encryption algorithms
  • Guide to forms based website authentication
  • Large collection of free Microsoft eBooks
  • Succint data structures

SQL Server

  • Precise or fuzzy matching with CONTAINSTABLE
  • NOEXPAND hint to use indexed views
  • COUNT(*) vs. COUNT(1) vs. COUNT(pk)
  • Why sum of nothing is null
  • 13 things you should know about statistics and the query optimizer
  • NULL Comparison Search Conditions
  • SQL Performance
  • Best way to remove time from datetime
  • T-SQL: COALESCE vs. ISNULL vs. IS NULL OR
  • Stored procedure template using TRY CATCH
  • SQL grouping ranges
  • Understanding how SQL Server Executes a Query

Links

  • Code is not physical property
  • Netherlands first country in Europe with net neutrality
  • Twitter fights government subpoena
  • W3Schools Intervention
  • How I became a Password Cracker
  • Are databases and programming at odds?
  • Prey project
  • USB chargers, Apple is not the best
  • When the nerds go marching in
  • Junior DBA Interview Questions
  • MySQL at Facebook: What is the query plan for a running query?

News

  • Does your job create real value?
  • Google goes back to the future with SQL F1 database
  • Man's $600,000 Facebook Disaster Is A Warning For All Small Businesses

Humor

  • What a crappy evening in 1998 looked like
  • Exploits of a mom
  • FunnyJunk tries to sue The Oatmeal
  • Programming skill vs blood alcohol concentration
  • Maslow's hierarchy of needs
  • Google Fiber vs. Broadband

Archives

  • February 2016 (2)
  • July 2014 (1)
  • December 2013 (1)
  • November 2013 (1)
  • September 2013 (3)
  • August 2013 (1)
  • July 2013 (2)
  • June 2013 (1)
  • May 2013 (1)
  • March 2013 (1)
  • January 2013 (1)
  • August 2012 (4)
  • July 2012 (4)
  • June 2012 (7)
  • May 2012 (3)
  • April 2012 (6)

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Tags

7-Zip Active Directory Apple bulk insert centos cURL Date Efficiency Excel FreedomPop function gitblit Java MacBook Msg 207 Msg 2714 Msg 7314 MySQL mysqli openrowset Oracle Parsing PDO PHP PHPExcel PostgreSQL RSS SharePoint shell SQL sql-case sql-coalesce sql-isnull SQL Server squirrel stored procedure String T-SQL Talend temporary tables usb VirtualBox Virtual Machine Windows XML
© 2025 Just a Day in the Office. All rights reserved.
Hiero by aThemes