Search results for "pivot"

Your search for "pivot" returned 100 results:

Technical Article

Pivot Table round to 1 deciaml.

  • Topic

Hi All,I am new to forum, so forgive  me if I post something incorrectly. I have the following qry. However I would like to be able to round output to 1 decimal place only. Qry: Output: So I would like to have for example 93.3 only and not 93.33333333.So any help will be much appreciate. Thanks […]

You rated this post out of 5. Change rating

2019-01-17

1,149 reads

Technical Article

Indexing for Pivot Performance?

  • Topic

Hi SSC, I've got a table which is wasting a lot of space in it's current narrow format and I'd like to pivot it out. The table contains about 44 million rows. The example below is a scaled down version of what I'm dealing with. The idea being to pivot out the [Measure] values into […]

You rated this post out of 5. Change rating

2013-07-24

1,877 reads

Technical Article

Pivot columns to get 0 /1 flag columns

  • Topic

Hi, I have a dataset of employees with different "Paytypes" in a single column. I am trying to pivot the table on the Paytype column so that each paytype can be treated as a flag column, i,e, the only possible values in this column should be 1 or 0 Below is a sample code with […]

You rated this post out of 5. Change rating

2022-09-04

438 reads

Technical Article

UNION vs. PIVOT for de-flattening SOME columns of a partially flat table

  • Topic

We have a table with 500+ columns. The data is non-normalized, i.e. there are four groups of fields for for "people", followed by data that applies to all people in the row (a "household"). For ad-hoc queries, and because I wanted to index columns within each person (person 1's age, person 2's age, etc.), I […]

You rated this post out of 5. Change rating

2015-01-23

645 reads

Technical Article

PIVOT taking forever unless temp table var used

  • Topic

This is a bit of an odd one for me.. I have a query that returns: Response_ID UNIQUEIDENTIFIER, Alias VARCHAR(MAX), Answer_Raw VARCHAR(MAX) This query is quick.. returning in less than a second. If I try and run this: SELECT Response_ID, [Gender], [YoB], [AgeAtEnroll], [Ethnicity], [Race_americanindian], [Race_asian], [Race_black], [Race_nativehawaiian], [Race_white], [Race_unknown], [Race_notreported], [Handedness], [Employment], [EnglishPrimaryLang], [LearnedEnglishAge], […]

You rated this post out of 5. Change rating

2019-12-19

1,376 reads

Technical Article

PIVOT - Maximum number of pivoted columns

  • Topic

What is the maximum number of columns that can be Pivoted uisng the PIVOT command in SQL 2008 R2? Im currently pivoting around 300 columns and its all working fine. But thinking about future expansion of the system and I'm a little worried if there is a physical limit (in much the same way you […]

You rated this post out of 5. Change rating

2012-10-09

2,068 reads

Technical Article

Subquery issue in PIVOT

  • Topic

Is it possible to have a subquery in a PIVOT statement? Reason I'm asking is the subquery returns the desired results but doesn't work in the PIVOT: SELECT DISTINCT Skill FROM [a2wh].[dbo].[vw_CallLogCommon_2021] WHERE date = '2021-10-10' ------------------------------------------------------------------------- SELECT * FROM ( SELECT count(call_id) as counts, call_id, date from vw_CallLogCommon_2021 group by date, call_id ) t […]

You rated this post out of 5. Change rating

2021-10-26

194 reads

Technical Article

Using CASE statement within a PIVOT

  • Topic

Hi Guys, I am using a PIVOT function to obtain the Invoice Values, but they appear in different currencies so need to perform a case function. But am struggling with the syntax; This fails a syntax check with Msg 156, Level 15, State 1, Line 33 Incorrect syntax near the keyword 'Case'. The script I […]

You rated this post out of 5. Change rating

2014-06-17

3,124 reads

Blogs

How Redgate Flyway Can Boost Your DevOps Journey

By

A brief introduction to the tool and its advantages for database migrations DevOps is...

Building a Docker image with Docker Build Cloud

By

In a previous blog post we went through how to build a Docker container...

Top 8 Courses to Learn SQL for Data Science in 2024 & Beyond

By

Businesses are drowning in data, but starving for insights. That's where SQL experts swoop...

Read the latest Blogs

Forums

How to compare data in customer table with other customers to find related cust

By Zond Sita

select Custno, Addr1, City, Res_Phone, Bus_Phone, Fax_Phone, Marine_Phone, Pager_Phone, Other_Phone, email1, email2 from customer...

process records in loop

By Bruin

I'm only processing 50,000 records not everything from the Table where there are 250,00...

The Marked Transaction

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The Marked Transaction

Visit the forum

Question of the Day

The Marked Transaction

I want to mark a transaction in the log as a recovery point. How do I do this in my code if I use the transaction, myTran?

See possible answers