Looking For A Way To Turn Column Headings Into Rows

Apr 2, 2008

I am relatively new to SQL and have experience with relatively simple queries and data manipulation. I have just finished creating a fully normalized database, which, of course, is presenting me with a few problems retrieving data. I'm not sure if I'm even taking the right approach. Anyway, I am trying to create a web search with a filter. I want my filter to be based upon different columns in a view, rather than rows in one column. I have the following columns:


Emp_Title, Department_Name Company_Name Office_Location, Practice_Area_Name, Practice_Group_Name, School_Name, Emp_Zip_Code

I want to populate a drop list with these column headings. So I thought I would need a way to make a dummy column named Category or something, and then make each of these columns a row in the the Category colum. Can that be done?

Any help would be appreciated.

View 3 Replies


ADVERTISEMENT

SQL DTS Source Without Column Headings

Mar 3, 2004

If the SOURCE doesn't have column headings in a txt file (the format will be pipe delimited), how can I make it work (Through DTS) to load the source into my designed SQL Table? Thanks in advance!

Jqiu

View 4 Replies View Related

Using Records As Column Headings

Sep 22, 2006

This may be a stupid question, but I have a table of orders that consists of various data. I want to take by date all orders that have been completed but have not had a previous order in 180 days. I have this part done. What gets returned is Date, Count, Status. What I want to get is the various status's returned as headings. So I get Data, Total Order Count, Completed Count, Abandoned Count, etc. I'm returning this data to Excel for display. My original thought was seperate queries, but some of the data will not have a count so the ordering would be off. Any ideas?

View 3 Replies View Related

Force IS To Use Column Headings

Feb 2, 2006

Hi,
I've got an IS package which reads a lot of records from a text file and loads that into the database. The text file has column such as Firstname, Lastname, phone number etc and same as the database table.

The problem:
IS works fine if I have the text file columns in the same order as the database columns but for example if have phone number in the place of firstname (in the text file) IS puts the phone numbers as firstname in the database and moves all the columns dow the order.

Is there anyway I could force IS to use the heading names in the text file and put it in the appropriate database columns?

Thanks guys...

View 4 Replies View Related

Scrolling Column Headings

Nov 30, 2007

Greetings,

I have generated a report that requires the user to scroll down the page since it is fairly long. I want to be able to show the column headings as the report is being scrolled. Much like excel locking the column headings as you would scroll down the spreadsheet so you know what values correspond to what heading. How do I configure this report to do this? Any suggestion is greatly appreciated. Thanks!

View 6 Replies View Related

Dynamically Changing Column Headings

Feb 5, 2008

We have a query in which we have data in fields called TS1Min, TS1Max, TS1Avg, TS2Min, TS2Max, TS2Avg etc.

We have a different table in which we define that vale of TS1, TS2, as an example TS1 might equal RED, TS2 might equal BLUE.

We have written a query that puts TS1Min, TS1Max, TS1Avg, TS2Min, TS2Max, TS2Avg in a temp table #TEMPA

and we also put the values of RED and BLUE in another temp table #TEMPB

now we want to select * from #TEMPA but rename the headings TS1Min to display RED-TS1Min, TS1Max as RED-TS1Max, TS1Avg as RED-TS1Avg etc...

any ideas on how to do this

View 4 Replies View Related

Is There A Feature In RS2005 For Using Different Languages In Column Headings?

Nov 16, 2007

we'd like our users to have the option of choosing the language (eg French) for column headings (maybe report heading too). I'm sure I'd have to provide the translations somehow but I'd like to know what feature, if any in RS2005 comes the closest to doing/supporting this, even if it is something like making column headings themselves dependent on a variable?

View 5 Replies View Related

Isqlw - Suppressing Column Headings In Output Files

Jun 5, 2001

I'm using isqlw to generate delimited text files from scripts. There are several SET options available so that you can restrict the output to just the data in the script, for example SET NOCOUNT ON.

I can't find a similar SET option to suppress the column headings, although there is a tickbox that allows you to do this in Query Analyzer (Query -> Current Connection Options -> Advanced -> Print Headers)

DTS packages appear to support this, yet I can't find the setting from a dts file.

Thanks,

Paul

View 1 Replies View Related

Cannot Copy Field Names In Column Headings From View Results

Jan 8, 2007

When I am using a SQL Query I have an ability to control whether or not I am able to Include the Column Headers when copying or saving results.

The control exists in the Options > Query Results > Results to Grid > Include column headings etc.

My question is how to get this same ability when attempting to copy the results of a VIEW vs. a Query.
The idea is that when I setup a view it€™s a drag/drop type of query building (query building for dummies if you will). Once I have a view and click the Execute icon it will return all the records selected by the View. However, when I click the upper left/top box to select all rows and column and then try to copy/paste the records into Excel all the data copies just fine but the field name/column headers are not there.
How can I get the header fieldname date to copy/paste from View result set that I'm able to copy from a Query result set?
Thank you,
Mike

View 1 Replies View Related

Problem With MSAccess And Executing A DTS Package Via VBA - Returns Column Headings Only

Jan 31, 2007

I wonder if anyone can help with this. I have searched around and not found much on the topic which can resolve my problem.

History on the reason for using VBA and not C# or VB or VB.net etc. Whn I arrived at this company, there were no development tools so had to resort to Access and VBA. Of course, the routines I wrote are now set in production and I haven't had much time to convert them to c# and ASP.NET (which I have learnt over the past couple of years).

Anyway the problem is that I found on the SQLDTS.com site that I could in fact create and execute DTS packages within VB and followed the examples and got this working in VBA. Of course I created the DTS first and then saved it as VB, then used the resulting code with the VBA project etc etc. This worked well and we were happy.

The DTS packages I create and execute are to export data from SQL2000 tables to tabs in Excel spreadsheets.

Now I find that on my machine, when the objPkg.execute command runs, the Excel file is created but only the query column headings are populated into the excel file. No data is returned.

If I run this on a different machine it works (although having said that, the other machine is now starting to display similar behaviour on some routines).

we created a version of the Access 2000 MDB in Access 2003 some time ago and the Access 2000 still behaves correctly. The strange thing is that my machine has only started doing this incorrectly a little while ago (not sure how long now but could be as little as a couple of months). The routines are monthly processes so it's only going to show up as a problem once a month so the fact that it used to work on my machine and has only failed the last couple of times means that something must have changed on my setup. I am runningXP-Pro SP2 - fully patched, Office Pro 2003 and talking to SQL 2000 SP3a

is it possible that some windows updates or office updates are clobbering something which used to work?

If I allow the VBA to create the DTS but not execute it, I can execute the created DTS manually from SQLEM and it outputs data correctly.

No security access to the SQL databases/table has changed, nor have there been any changes to security on the file system where the files are written.

It's weird.

Any help would be gratefully accepted.

Annabel



I'm really lost and not sure whether I should look at driver versions, ODBC versions blah blah

View 1 Replies View Related

SSIS Database Table To Flat File Destination With Column Headings

Sep 8, 2006

Hi,

I have a simple enough task to complete that I can€™t seem to find the answer to.

The task is this €“

Select table x from the database and write it to a flat file complete with that tables column headings.

Now I€™ve managed to set up an ole db datasource and selected the table and I€™ve also linked it to the flat file output.  So now I can generate a flat file from the database.  However no column headings appear in the flat file. 

I can€™t seem to find anywhere (like a checkbox) that will also output the column headings to the flat file. 

Now I can add in Headings manually in the properties of the Flat File Destination object but the columns that appear in the flat file don€™t appear to be in the order that I requested them in the SQL.

So the question is how do I automatically have the column headings appear for flat file output (ideally without me having to manually add them in).

If it can€™t be done and I have to use a vb.net script instead then would anyone have an example script of how to do it?

Thanks in advance for anyone who manages to answer this.

Matt.

View 6 Replies View Related

Transact SQL :: Turn Rows Into Named Columns Using CASE

Nov 19, 2015

That may not be the most exact TITLE I have used for a question as CASE may not be the best expression to use but I have a query:

select AR.ClientID,
AR.ReferenceID,
AAC.SequenceID,
AA.AppearanceDate,
CASE
WHEN AAC.Outcome IS NULL Then 'Cancelled' else

[Code]....

This returns the following data set:

ClientID ReferenceID
SequenceID AppeareanceDate
Outcome Rownum

1000000 2
2000358 2005-11-07
Yes 1

[Code] ...

What I want the eventually solution to be is that for each unique/distinct client, reference and sequence there is one record (row). Based on the row_number, I want the first 'AppearanceDate' renamed to 'AppearanceDate1' with the first AppearanceDate as the data and the first Outcome to be renamed 'Outcome1' with the first Outcome as the data. Any subsequent rows would follow as columns:

ClientID ReferenceID
SequenceID AppeareanceDate1
Outcome1  AppearanceDate2
Outcome2
1000000 2
2000358 2005-11-07 
Yes NULL

[Code] ...

Only four AppearanceDates and outcomes are required based on the unique/distinct Client, Reference and SequenceIDs. How I can loop through the Appearances based on the row_number and show each record in one row?

View 3 Replies View Related

Turn Value Into Column

Feb 23, 2015

I have this table:

ProductionID ResourceID Time
------------ ---------- -----
WO001 200012 5
WO001 200011 1
WO002 200013 2
WO003 200012 3
WO003 200032 4

and I want it to look like

ProductionID 200011 200012 200013 200032
------------ ------ ------ ------ ------
WO001 1 5 NULL NULL
WO002 NULL NULL 2 NULL
WO003 NULL 3 NULL 4

I am looking for a smart solution without hardcoding the column names (e.g. CASE WHEN ResourceID = '200012' THEN Time END as ['200012'], etc...), as there can be up to 15 different resources involved; usually they aren't but I want to keep the result as slim as possible without tons of columns containing nulls.

View 8 Replies View Related

SQL 2012 :: Turn Row Data To Column

Aug 19, 2015

ItemID ItemName Price
1 Test 1 100
1 Test 1 200
2 Test 2 130
2 Test 2 150
3 Test 3 300
3 Test 3 400
...

How to write a query to bring price data to column so the Item is not duplicate any more.

The result should be:

Item ID ITemName PRice1 PRice2
1 Test1 100 200
2 Test2 130 150
3 Test3 300 400

View 9 Replies View Related

Reporting Services :: Saving Report With Taller Column Headings To Excel Cuts Off Taller Headers

Nov 20, 2015

we are running 2014 enterprise. A couple of column headings (even with smaller font) are a little tall, as much as 6 "lines".   All headings in the respective matrices are aligned vertically as "bottom".  When I save the report to excel, these taller headings get chopped off visually in their excel cell.   The cell contains the entire heading.  It appears that the second "line" of the heading is the one that is most visible in excel. 

How do I get these to be saved so user will see entire heading when opening excel doc? In the first matrix there is a text box directly above the matrix and only one row of column headings.  In the second there is a higher column group heading containing month name above the problem headings. 

View 4 Replies View Related

Turn Columns Into Rows And Rows Into Columns

Jan 24, 2008

I have a report which is a list of items and I display everything about the item. It is great. My report table in the layout tab is simple. Header,Detail,Footer. Each Item has 65 columns. The number of items (rows) vary upon what you want to see. Example data.
Item#, Description, CaseSalePrice, Cost, BottleSalePrice, Discount
123, Grenadine, 100.00, 75.00, 15.50, 2.00
456, Lime Juice, 120.00, 81.00, 17.25, 2.00

There could be 1 item or 4000 items.

What I want to see is.

Item # - 123, 456
Description - Grenadine, Lime Juice
CaseSalePrice - 100.00, 120.00
Cost - 75.00, 81.00
BottleSalePrice - 15.50, 17.25
Discount - 2.00, 2.00

What I am actually doing is running this the top example and saving to excel. Then copying the sheet. Creating a new sheet then doing a paste special transpose and this gives the users what they want to see.

I want to grab that table object in the report layout tab and twist it 90degrees so the header is on the left, detail is in the middle and the footer is on the right. It would be perfect.

The dynamic column need is really the problem here. I never know how many items will be in the report. They all have the same basic information like description and pricing.

I am all out of creative ideas, any help would be appreciated.

View 6 Replies View Related

Transact SQL :: Selecting Rows As Column Name And Other Column Values As Rows

Jun 25, 2015

I have questions and answers from one table, I need to select questions as column names and answers column values as the results for the questions column.

View 28 Replies View Related

How To Show Distinct Rows Of The Column Of The Dataset And Number Of Distinct Rows Of That Column

Mar 29, 2007

suppose i have aDataset with 11 rows. field1 with 5 rows of aaa, 6 rows of "bbb"

I want's some thing like

field1 rowcount
aaa 5
bbb 6

View 1 Replies View Related

BCP - Output With Headings

Jun 13, 2007

Does anyone know how to output the contents of a table via BCP utility to a file WITH the column headings?

Thanks in advance,
--Alla

View 5 Replies View Related

Get Field Headings?

Mar 17, 2004

I use the following to get the column names from a table but it is giving the error "Incorrect syntax near the keyword 'Where'"

Here is the Stored Proc:

CREATE PROCEDURE usp_GetTemplatePrompts

@cCode varchar(5)

AS

declare @cTableName varchar(100), @iError int, @cError varchar(255)

SELECT @cTableName = s.TableName
FROM tbShapes AS s INNER JOIN tbProductCodes AS pc
ON s.Shape = pc.fkShape
WHERE pc.Code = @cCode

SELECT @iError = @@Error
if(@iError = 0)
BEGIN
EXEC('SELECT * FROM ' + @cTableName + ' WHERE Template = 0')
SELECT @iError = @@Error
END

if(@iError <> 0)
BEGIN
set @cError = 'Error while attempting to get input fields for product ' + @cCode + '.'
RAISERROR(@cError, 16, 1)
END
GO


The table structure is as follows:


tbProductAccounts
Account (PK) | Description

tbProductCodes
Code (PK) | fkAccount | fkShape | Description

tbShapes
Shape (PK) | TableName | ShapeName

tbDoubleT
Template (PK) | fkCode | SectionName | Width | Height | Flange

tbRectangular
Template (PK) | fkCode | SectionName | Width | Height

tbCircular
Template (PK) | fkCode | SectionName | Radius

tbTSection
Template (PK) | fkCode | SectionName | X1 | Y1 | X2 | Y2



Any ideas?

Mike B

View 1 Replies View Related

Csv Export Without Headings

Jan 15, 2007

Hi,

is it possible to export a report to a csv file without the headings?

at best i have been able to hide the headings in the report, but when exported to csv file it includes a row at the top of commas, then the data follows. I need the file to be just the data.

thank.

View 10 Replies View Related

Transact SQL :: Find Unique Rows In Column That Are Associated With Another Field In Another Column?

May 1, 2015

I am having issues trying to write a query that would provide me the unique GUID numbers associated with a distinct PID if the unique GUID's > 1.  To summarize, I need a query that just shows which PID's have more than one unique GUID. A PID could have multiple GUID's that are the same, I'm looking for the PID's that have multiple GUID's that are different/unique. 

Table1

GUID PID
GUID1 PID1
GUID1 PID1
GUID1 PID1
GUID2 PID1
GUID3 PID2
GUID3 PID2
GUID3 PID2

The result of the query would only have PID1 because it has two unique GUID's. PID2 would not be listed has it has the same GUID3 in each row.

Result:

PID1 

View 2 Replies View Related

Concatenate Column Value From Multiple Rows Into A Single Column

Feb 27, 2008

Hello,

I need to concatenate a column from multiple rows into a single column in a new table.

How can I do this?

SID NAME PGROUP
------------------------------------------------------------
3467602 CLOTHINGACTIVE
3467602 CLOTHINGDANCE
3467602 CLOTHINGLWR


Need to have

SID NAME PGROUP
------------------------------------------------------------
34676 02 CLOTHING ACTIVE , DANCE, LWR


THANK YOU

View 10 Replies View Related

Vertical Text In Report Headings

Oct 30, 2007

Hi,

Is it possible to display Report headings text vertically bottom-up?
It goes from top to bottom by default now, which seems unusual.

Thanks,
Alex

View 1 Replies View Related

How To Substract New Rows From Old Rows In The Same Column?

Mar 7, 2008



Hi I'm having a bit troubble by creating a SQL-sentence which substract the newest row from the second newest row in the same column. The table looks like this:

Pricecalcid Date Price Itemid
2000 2006-12-12 3000 100
2488 2007-10-11 2800 100
3100 2008-08-07 2500 100



What I need is that the largest "Pricecalcid" that is 3100 equals "Price" 2500 and the second largest "Pricecalcid" eqauls 2800 results in a pricecalculation that substracts 2500 from 2800 for "Itemid" 100.

How do I do that?

Thanks

Morten

View 9 Replies View Related

Best Practice For Headings Above Dynamic Row Headers In A Matrix?

Dec 28, 2007

what is considered the best practice for placing headings above dynamic row headers if you want them to float with the row headers when scrolling horizontally?

View 8 Replies View Related

Matrix Headings On 2005, Pain In The Neck

Jan 9, 2007

Hello,

I know this is a known issue since SSRS 2000, but it seems that it hasn't been solved: How can I have column headings on a Matrix Report ? (not in the data region, just in the columns that identifies the rows).

All the workarounds and tricks that I have found are quite nasty and have drawbacks when you export to Excel, for instance:

- Using a table inside upper left blank area in the matrix report: Problem, when you export to excel you loose the Header.

- Using an rectangle and placing textboxes (tweaking with pixels... :-(): When you export to excel you get excel columns merged, quite bad if somebody wants to make some macros or calculations).

- Using a list report... well I need a matrix report :-).

Is there other way to implement this ? This is a known issue since 2000 came up, no really a solution available ? I have seen on SP-2 and there is no solution for this issue... please heeelp.

Greetings

Braulio

View 1 Replies View Related

Dynamic Group Headings With Table Groups (Toggle)

Apr 21, 2008

Hi,

I have a SSRS 2005 report with a table and several groupings. These groupings are made visible with toggle items.
I am trying to determine how to make the associated group headings (entered within table header) visible or not visible depending on the visibility state of the groupings.

Example: (initial state with group1 only visible)
Group1 Heading Count Sum
+Group1 999 999

(click + sign to make visible group 2)
Group1 Heading Group2 Heading Count Sum
-Group1 999 999
+Group2 888 888

etc.. for remaining groups

I've tried toggling the table header column the same way I did the group, but the group scope isn't available so I don't know what to use. (Manually putting it in causes report error.)
I don't know what visibility expression to use because I can't figure out what report item I can look at to determine the group's visibility "status" in order to make an expression.

Any ideas?

Note: I did see a similar post from sadsac, but the "answer" didn't address this.

Thanks

View 1 Replies View Related

Rows To Column

Sep 26, 2000

hi
i have a query that returns 1 column 5 rows which i want as 1 row 5 columns

SELECT columna
FROM atable

would become??

thanx
Liju

View 5 Replies View Related

Two Rows To One Column

Jan 11, 2006

How to put two rows of data in one column?
from
dealID dealNO
1 888
1 999

to
dealID dealNO
1 888,999

you can't use create permission, so can't create storedprocedure.
Pls help.

View 4 Replies View Related

Get Some Rows Into One Column

Oct 31, 2007

Hello,can I do this via SQL:example: tbltest has 5 rows:col1===ACFMRWhat I want is this:result:===============A, C, F, M, RDo I really have to go through the rows per SP? I could do this:SELECT UDF(col1)FROM tbltestAin't there a more simple way, maybe theres a T-SQL-command ?thxcandide_sh

View 6 Replies View Related

How Can I Turn A -100 Into 100

Apr 6, 2008

This may sound silly, but I'm calculating how much someone owes over time verses how much they have paid for that period. So if they owe more than they have paid the result is an under payment amount like -$100. Then I need to add the -$100 to the new payment due, let's say $100. So the total Due is $200. But if I add -100 to 100 that equals 0.
Any suggestions?
 

View 3 Replies View Related

DTS - How To Turn On NO LOG !!!

Aug 3, 2001

How do you turn LOGGING OFF for a DTS package????

DB2 is a simple "LOAD DATA REPLACE NO LOG"... (can SQL Server make it any more difficult to find this option to turn on/off??!!!)

frustrated!!!!!!!!!!!!!!!!
thanks-

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved