Help: Need To Set Default Dimensions On Rows And Columns

Jun 1, 2005

When I open my Cube the default dimension on Rows is the dimension name that is first on the alphabetic list and on the columns it defaults to the time dimension.

I need to specify a specific dimension to be shown on rows and columns when the cube is viewed.

The analysis server is 2000 with SP3.

Thanks in Advance for the assistance

View 1 Replies


ADVERTISEMENT

Analysis :: Show Dimensions Like Columns In MDX

Jun 25, 2015

I need to show the dimensions of my model like columns in the result. I have this query

with 
member [Measures].[Customer] as [Customers].[Customer].CURRENTMEMBER.Name
member [Measures].[UCs] as [UCs].[UC].CURRENTMEMBER.Name
member [Measures].[Order Type] as [Order Types].[Order Type].CURRENTMEMBER.Name
member [Measures].[UC Dates] as [UC Dates].[UC Date].CURRENTMEMBER.Name

[Code] .....

View 14 Replies View Related

Arranging Data On Multiple Rows Into A Sigle Row (converting Rows Into Columns)

Dec 25, 2005

Hello,
I have a survey (30 questions) application in a SQL server db. The application uses several relational tables. The results are arranged so that each answer is on a seperate row:
user1   answer1user1   answer2user1   answer3user2   answer1user2   answer2user2   answer3
For statistical analysis I need to transfer the results to an Excel spreadsheet (for later use in SPSS). In the spreadsheet I need the results to appear so that each user will be on a single row with all of that user's answers on that single row (A column for each answer):
user1   answer1   answer2   answer3user2   answer1   answer2   answer3
How can this be done? How can all answers of a user appear on a single row
Thanx,Danny.

View 1 Replies View Related

T-SQL (SS2K8) :: Rows Into Columns - Remove Duplicates And Variable Rows

Aug 5, 2014

I managed to transpose rows into columns.

;WITH
ctePreAgg AS
(
select top 500 act_reference "ActivityRef",
row_number() over (partition by act_reference order by act_reference) as rowno,
t3.s_initials "Initials"
from mytablestuff
order by act_reference

[code]...

But what I would love to do next is take each of the above rows - and return the initials either in one column with all the nulls and duplicate values removed, separated by a comma ..

ref, initials
Ag-4xYS
Ag-6xYS,BL
Ap-1xKW
At-2x SAS,CW
At-3x SAS,CW

OR the above but using variable number of columns based on the maximum number of different initials for each row.this is not strictly required, but maybe neater for further work on the view

ref, init1,init2
Ag-4xYS
Ag-6xYS,BL
Ap-1xKW
At-2x SAS,CW
At-3x SAS,CW

View 6 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

Adding DEFAULT Columns

Jul 23, 2005

HiI have a table that currently has 466 columns and about 700,000records. Adding a new DEFAULT column to this table takes a long time.It it a lot faster to recreate the table with the new columns and thencopy all of the data across.As far as I am aware when you add a DEFAULT column the followinghappens:a) The column is added with a NULL propertyb) Each row is updated to be set to the DEFAULT valuec) The column is changed to NOT NULL.However, adding the column as NOT NULL with the DEFAULT seems to take alot longer than if I do steps a) - c) separately.When I say a long time, adding just a single DEFAULT column takesaround 6 hours. Surely it should not take this long?There is a trigger on this table but disabling this does not seem tomake much difference.Can anybody give me any advice on the use of DEFAULT columns please?When should they be used, benefits, disadvantages, alternatives etc.Also should it really take as long as it is taking or is there aproblem with my setup?If I am honest I can't see why DEFAULT columns should be used as thevalues could always be inserted explicitly via the applicationThanks in Advance.Paul

View 5 Replies View Related

Default Value Being A Concatenation Of Other Columns

Jul 19, 2007

Hello all,Does anybody know if it is possible to set the default value of afield to equal the concatenation of 2 other fields?I.E.Field 1 = 123Field 2 = 345Field 3 = (Field1 + Field2) = 123345This is easy enough to do using a stored procedure, but I'm trying touse the import tool and so need to do the concatenation by default.Many thanks,Drew.

View 1 Replies View Related

Dropping Columns With Default Constraints

Oct 13, 2004

Hi, I want to drop a column from a table with default constraint. It is giving me error..
------------------
Server: Msg 5074, Level 16, State 1, Line 1
The object 'DF__ACTIVITY___ROLLU__108B795B' is dependent on column 'ROLLUP_BGT_COST_FIXED'.
Server: Msg 4922, Level 16, State 1, Line 1
ALTER TABLE DROP COLUMN ROLLUP_BGT_COST_FIXED failed because one or more objects access this column.
-------------------------

Here is the drop statement
-----------
DROP STATISTICS ACTIVITY_BASELINE.ROLLUP_BGT_COST_FIXED
ALTER TABLE ACTIVITY_BASELINE DROP COLUMN ROLLUP_BGT_COST_FIXED;
------------------------

How can I first drop the constraint?

View 10 Replies View Related

Create Table With 15,000,000 Default Rows

Jul 23, 2005

Hi I want to create a table with one column, which is a identitycolumn.Let's say like this:CREATE TABLE DefaultTable(N int identity(0,1))Then I want to fill this table with 15,000,000 records, so that I havea table with the numbers 0 to 14,999,999.How can I do this as fast as possible. A standard INSERT would take along time.(It can be a temp table or a table variable. I just need a list withnumbered 0 to 15,000,000)Thank you.Gidon

View 2 Replies View Related

Default Empty String Value For Varchar Columns

Jun 4, 2008

Hi guys,
Is there a way to declare a default value of empty string '' for a varchar table column?
Thanks,Kevin

View 4 Replies View Related

SQL 2012 :: How To Find Columns That Have Default Constraints

Oct 22, 2015

CREATE TABLE XYZ
(
ID int DEFAULT 5000,
NAME VARCHAR(100)
)

I have many tables that have many columns with default values

Is there a way to get a listing of

TAB_NAME, COL_NAME, Data_type, Default_Value

View 2 Replies View Related

Default Constraint On Columns Pros And Cons?

Oct 26, 2007



Are there any vices to using default constraints on all columns in your table.
For example an Int that defaults to 0
or a char or varchar that defaults to ''

I know that 0 and Null are not the same thing. But if your programs don't have the concept of NULL then you have to convert the NULL to zero.

So, DEFAULT CONSTRAINTS on every column. Is it good or Bad?

Thanks

Darin Clark

View 10 Replies View Related

Identity, Default Values And Multiple Rows

May 27, 2008

Howdy all,
I've run into an interesting scenario that I can't seem to resolve.

We have a table that we are using to create sequence ids. It's literally a table with a single field with the identity value turned on.

create table ident (seq_id int identity(1,1) primary key NOT NULL)


If I want to grab a new sequence id, I can execute

INSERT INTO
ident
DEFAULT VALUES
SELECT scope_identity() AS seq_id


All is well and good. However, now let's suppose that instead of just one, I'd like to get a range of values.

If the table had one other field in it, I could do the following

create table ident2 (seq_id int identity(1,1) primary key NOT NULL, placeholder char(1))
GO
;
WITH RECORDS AS
(
SELECT
CAST('A' as char(1)) AS col1
UNION ALL
SELECT
char(ascii(col1) + 1)
FROM
RECORDS
WHERE
col1 < 'C'
)
INSERT INTO
ident2
OUTPUT
INSERTED.seq_id
SELECT
NULL
FROM
RECORDS


Can this be done if there is only the identity column and if so, someone care to educate me?

View 10 Replies View Related

Inserting Default Values On Inserted Rows

May 12, 2008

Hi!

I want to merge in a Datawarehouse, data of "source databases"

I need to insert on destination inserted rows a default value, acording to the datasource of the rows.

Something like in the field <SOURCE> fill on correspondent ROW the value <DATASOURCE1>
the row data is filled with default DATASOURCE value.

in nowdays i can extract and load the data of sources but i know how i can do this inserts,

thx.

View 1 Replies View Related

Identity, Default Values And Multiple Rows

May 27, 2008

Howdy all,
I've run into an interesting scenario that I can't seem to resolve.
We have a table that we are using to create sequence ids. It's literally a table with a single field with the identity value turned on.




Code Snippet
create table ident (seq_id int identity(1,1) primary key NOT NULL)





If I want to grab a new sequence id, I can execute




Code Snippet
INSERT INTO
ident
DEFAULT VALUES
SELECT scope_identity() AS seq_id






All is well and good. However, now let's suppose that instead of just one, I'd like to get a range of values. If the table had one other field in it, I could do the following




Code Snippet
create table ident2 (seq_id int identity(1,1) primary key NOT NULL, placeholder char(1))
GO
;
WITH RECORDS AS
(
SELECT
CAST('A' as char(1)) AS col1
UNION ALL
SELECT
char(ascii(col1) + 1)
FROM
RECORDS
WHERE
col1 < 'C'
)
INSERT INTO
ident2
OUTPUT
INSERTED.seq_id
SELECT
NULL
FROM
RECORDS





Is there a way to do this if there is only the identity column and if so, someone care to educate me?

From a design perspective, all I can say is "it's not mine" but I do have to live with it, or at least my coworker has to live with it. I'm merely trying to prevent them from opening a cursor and calling the default values version 45M times and no, that's not an exageration.

View 2 Replies View Related

Why Do Some System Views Have Columns With Different Collations Then The Default Collation?

Oct 8, 2007

I'm recreating many of my DBA scripts that no longer work in 2005 due to the rework of system tables. It's a risk I lived with knowing that someday the system tables would change. I'm now encountering collation problems, which I do not understand. I know how to fix the problem, but I don't know why the collation issues exist in the first place.


Run the following command.


Select * From sys.all_objects a JOIN master..spt_values b on a.type = b.type

You will receive the following error.


Msg 468, Level 16, State 9, Line 1

Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS_KS_WS" in the equal to operation.


Now run sp_help 'sys.all_objects' and look at the collation defintion for columns "type" and "type_desc". In my environment they have a collation of Latin1_General_CI_AS_KS_WS. This is different then the overall default collation of SQL_Latin1_General_CP1_CI_AS, thus causing the error.


My question is why did Microsoft need to make this collation different for these columns?


Any ideas?


Thanks, Dave

View 3 Replies View Related

MS SQL Query, What's The Default Order The Rows Returned Are Sorted By?

Jan 12, 2005

i have a table and a column called req_id, i have it set as the primary key.. so if i just do SELECT * FROM table, shouldnt the rows returned be sorted by the order that the rows were inserted?

this database was improted from an access database.. when i did that in access it would return the rows in sorted order by the order the row was inserted.. but now in MS SQL, its not sorted in that order.. i can't really tell what type of order it's in

View 6 Replies View Related

Enter Default Values For All Columns In All Tables Except Primary Keys

Jul 23, 2005

How can i enter Default Values of " " to all the columns of type characterof all the tables (excluding system tables) and Default Values of 0of all columns of type numbers. Excluding all primary key columns.Thank you

View 1 Replies View Related

Why Date Columns Default To 1900 After Inserting Dates In SQL Server Everywhere.?

Sep 19, 2006

I have created a sample Database for the school project,

After executing the query below, the Date column is supposed to have the dates I have entered before,

However the dates shown are 1900.

Any idea why is this happening?

I appreciate your help.

Thank you.
Query:
 
Drop table AccountReceivable
GO
--BEGIN TRANSACTION
Create table AccountReceivable
(
 AccountRecID int identity (1,1) not null,
 PatientID int not null,
 PresentCharges int default 0 not null,
 PaymentMade money default 0 not null,
 PreviousBalance money default 0 not null,
 BalanceDue money default 0 not null,
 LastPaymentDate datetime not null,
 PresentDate datetime default GetDate() not null
)
GO
ALTER TABLE AccountReceivable ADD CONSTRAINT
PK_AccountRecID Primary Key (AccountRecID)
GO
 
ALTER TABLE AccountReceivable ADD CONSTRAINT
FK_PatientID_PatientID FOREIGN KEY (PatientID) REFERENCES PATIENT (PatientID)
GO
--COMMIT
--query to find delinquent accounts
--DATEDIFF (d, LastPaymentDate, PresentDate)
 
--Populate the Accounts Table
DELETE AccountReceivable
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate )
                    VALUES (913235,451.34,50,0,401.34,4/7/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (918035,109,109,0,0,3/6/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                            VALUES (914235,279,89,0,190,5/9/2005,5/9/2005)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                            VALUES (914235,0,90,190,100,5/9/2005,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (912224,67.90,67.90,0,0,2/2/2006,DEFAULT)
GO
 
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (900814,678.32,78.32,0,600,4/6/2006,4/6/2006)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (900814,0,500,600,100,4/6/2006,4/16/2006)
 
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (900814,0,100,100,0,4/16/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (913010,203,0,100,303,2/6/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (913010,0,80,303,223,8/3/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (913230,1030.89,1030.89,0,0,4/16/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (918035,78,60,0,18,7/1/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (941235,902,502,0,400,8/15/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (941235,0,200,400,200,8/15/2006,DEFAULT)
 
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (952235,134,24,0,110,4/18/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (952235,0,20,110,90,4/18/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (921635,257.87,57.87,0,200,5/27/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (921635,0,20,200,180,6/27/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (915235,1204,200,0,1004,3/15/2006,DEFAULT)
 
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (915235,0,100,1004,904,4/27/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (900035,578,178,0,400,7/10/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (900035,0,100,400,300,7/19/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (913241,157,0,0,157,5/12/2006,DEFAULT)
GO
INSERT AccountReceivable (PatientID,PresentCharges,PaymentMade,PreviousBalance,BalanceDue,LastPaymentDate,PresentDate)
                    VALUES (913241,0,57,157,100,5/16/2006,DEFAULT)
 
 
GO
 
--sample query

select PatientID,PresentCharges,LastPAymentDate,PresentDate from AccountReceivable

GO

--result

PatientID PresentCharges LastPaymentDate PresentDate

----------- -------------- ----------------------- -----------------------

913235 451 1900-01-01 00:00:00.000 2006-09-15 12:54:55.297

918035 109 1900-01-01 00:00:00.000 2006-09-15 12:54:55.297

914235 279 1900-01-01 00:00:00.000 1900-01-01 00:00:00.000

914235 0 1900-01-01 00:00:00.000 2006-09-15 12:54:55.297

912224 67 1900-01-01 00:00:00.000 2006-09-15 12:54:55.297

900814 678 1900-01-01 00:00:00.000 1900-01-01 00:00:00.000

900814 0 1900-01-01 00:00:00.000 1900-01-01 00:00:00.000

900814 0 1900-01-01 00:00:00.000 2006-09-15 12:54:55.313

913010 203 1900-01-01 00:00:00.000 2006-09-15 12:54:55.313

913010 0 1900-01-01 00:00:00.000 2006-09-15 12:54:55.313

913230 1030 1900-01-01 00:00:00.000 2006-09-15 12:54:55.313

918035 78 1900-01-01 00:00:00.000 2006-09-15 12:54:55.313

941235 902 1900-01-01 00:00:00.000 2006-09-15 12:54:55.327

941235 0 1900-01-01 00:00:00.000 2006-09-15 12:54:55.327

952235 134 1900-01-01 00:00:00.000 2006-09-15 12:54:55.327

952235 0 1900-01-01 00:00:00.000 2006-09-15 12:54:55.327

921635 257 1900-01-01 00:00:00.000 2006-09-15 12:54:55.327

921635 0 1900-01-01 00:00:00.000 2006-09-15 12:54:55.327

915235 1204 1900-01-01 00:00:00.000 2006-09-15 12:54:55.327

915235 0 1900-01-01 00:00:00.000 2006-09-15 12:54:55.327

900035 578 1900-01-01 00:00:00.000 2006-09-15 12:54:55.343

900035 0 1900-01-01 00:00:00.000 2006-09-15 12:54:55.343

913241 157 1900-01-01 00:00:00.000 2006-09-15 12:54:55.343

913241 0 1900-01-01 00:00:00.000 2006-09-15 12:54:55.343

(24 row(s) affected)

 

View 6 Replies View Related

Default Values Of Columns Not Transferred In SSIS Transfer Objects Task

Sep 6, 2006

I am working on a project that is creating a new application, my area of the project being the migration of data from the old application database, transforming it, and populating the new database.

The transformations to the old data are done in a staging database.

At the end of the process, the staging database ends up with a lot of new applications tables, populated with the migrated legacy data.

We need to move these tables from the staging database to (initially) our test databases, but ultimately what will be the live database.

We have tried using the "Transfer SQL Server Objects Task" in SSIS, but have ran into a problem that a lot of the database tables have default values for columns.

These default values are not brought over.

Example. Tables contain a "GUID" field, which has a default of value of newid()

Right clicking and the table generating the CREATE script generates

[GUID] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT [DF_tbCRM_Client_GUID] DEFAULT (newid()),

However, the Transfer objects task does not create this default of newid()

Examining the SQL generated by the Import / Export Wizard when investigating this shows that the wizard generates this column as

[GUID] uniqueidentifier NOT NULL

and the column default value is lost.

Is there something i should be setting somewhere to force SSIS to bring these column definitions over correctly?

View 10 Replies View Related

Transact SQL :: Adding A Column To A Large (100 Million Rows) Table With Default Constraint?

Apr 24, 2013

IF NOT EXISTS (SELECT TOP 1 1 FROM dbo.syscolumns WHERE id = OBJECT_ID(N'dbo.Employee) and name = 'DoNotCall')
BEGIN
ALTER TABLE [dbo].[Employee] ADD [DoNotCall] bit not null Constraint DoNot_Call_Default DEFAULT 0
IF ( @@ERROR <> 0 )
GOTO QuitWithRollback
END

It just takes a LOT of time in SQL Server Management studio. I have to cancel the query and cancelling takes a whole lot time. I am using SQL Server 2008.

View 4 Replies View Related

Columns Vs. Rows

May 10, 2007

hi,I'm building a multi-lingual website In my database tables I have, in some of them, a column with the Language, because some of the columns depend on what language the user wants to see the site.My question is:  what is better? have that column and consequently two row (for two languages) with repeated column information? or have two column within a row with the language specification?e.g. table: id, description, price(1) With language:id,description, price, language='EX' id,description, price, language='EN' vs.(2)  id, descriptionEN,descriptionEX,price   if I have 500 products in 1 whould result in 1000 entriesin 2 just 500 results can anyone tell me a diference/advantage between the two approachs?thanks in advance.  

View 1 Replies View Related

Rows As Columns

Oct 6, 2005

is it possible to write a query so that we can have all rows of one column in a  single columnTIA

View 1 Replies View Related

Rows Become Columns Help!

Dec 5, 2005

I am building a calendar table for the most reason four weeks activitis and I have had a temp table data in table A (See my attached file) and I want to
make it as the format in table B as final. How to convert it? Please help!

Thank you!

Suin

View 2 Replies View Related

Columns To Rows And A Sum

Nov 19, 2013

I am using SQL 2008. I have a database called ISCmetrics and a table called Meeting, the table meeting has 5 columns id

( int),TEAMNAME (varchar),DATECOMPLETE (varchar),STATUSNAME (varchar),STATUSLEVEL (varchar)

We have around 20 different team names , and every team enters data into the database every day, and we have around 7 Different STATUSNAME they are always the same , the STATUSLEVEL is always a 1 or a 0 , so TEAMA enters a value every day for each of the 7 STATUSNAME, and the value is either a 1 or a 0 .

The output for a Select * from ISCMetricslooks like this

id TEAMNAME DATECOMPLETE STATUSNAME STATUSLEVEL
1 TeamA 20131022 STATCONTACT 1
2 TeamA 20131022 STATACTION 1
3 TeamA 20131022 STATABC 1

4 TeamB 20131022 STATCONTACT 1
5 TeamB 20131022 STATCTION 0
6 TeamB 20131022 STATABC 1

7 TeamA 20131021 STATCONTACT 0
8 TeamA 20131021 STATACTION 1
9 TeamA 20131021 STATABC 0

10 TeamB 20131021 STATCONTACT 1
11 TeamB 20131021 STATACTION 1
12 TeamB 20131021 STATABC 1

What i am trying to achieve is this, i want the teams in one column then a column for each of the dates , and then sum of the STATUSLEVEL in each row as shown below for the day and team .....

TEAMNAME 20131022 20131021
TeamA 3 1
TeamB 2 3

View 20 Replies View Related

Rows Become Columns

Jan 18, 2007

hello all,
i am trying to create a view from a table that will keep track of the time between each stage of tasks given. take a look at the data below:


progressID taskIDstage status theDate
------------------------------------------------------------------------
1407525 1091657In Progress Logged 2006-11-16 10:00:24.000
1407526 1091657 In Progress Inprogress 2006-11-16 12:08:59.036
1407214 1091657In Progress Resolved 2006-11-16 14:15:48.000
1407220 1091657Closed Solved 2006-11-16 14:36:05.000


i would like to be able to have just one row per task ID showing the difference between the stages, as shown below . only the 2nd column is a date, the rest are are hours (datediff) between the stage and its preceeding stage :

taskID Logged InProgress Resolved Solved
1091657 2006-11-16 10:00:24.000 2.08 2.07 0.21


is it possible to achieve such a transformation using views and a number of select statements (i.e no dts)? all assistance will be highly appreciated.

regards,

ptah

View 2 Replies View Related

Rows To Columns

Jun 9, 2007

Afternoon

I am trying to write a query that will return the columns: year/ month, each status type (unknown how many types there are)

Each row is a different join year/ month

Each cell has the count of users that joined in that rows year/ month and currently have the status of the column.

At the moment I have the following query:

SELECT [remortgage-status].status, COUNT(1) AS CountTotal, YEAR([remortgage-log].datetime) AS Year, MONTH([remortgage-log].datetime) AS month FROM [remortgage-status] INNER JOIN [remortgage-log] ON [remortgage-status].clientid = [remortgage-log].clientid WHERE ([remortgage-log].action = N'Joined') GROUP BY [remortgage-status].status, YEAR([remortgage-log].datetime), MONTH([remortgage-log].datetime)

The problem is that each different status is a new row rather than each status being a column.

What do I need to do to correct this? - I dont know all the different possible statuses at this point

View 9 Replies View Related

Columns Into Rows

Feb 29, 2008

Hi,
I've a table called months with one column month. The result set will be
month
=====
Jan
Feb
Mar
...

Now i want to convert those values as rows. Means,

Jan Feb Mar
===========

Suggest me a solution for the above problem.


Thanks
Somu

View 2 Replies View Related

Rows As Columns

Jul 20, 2005

I know this is a self join, but I can't remember exactly how it goes.Could someone help me out?create table A{int idA,varchar(30) dataA}create table B{int idB,varchar(30) dataB}create table A_B{int idA references A(idA),int idB references B(idB)}insert into A values(1, "foobar")insert into A values(2, "barfoo")insert into B values(1, "a")insert into B values(2, "b")insert into B values(3, "c")insert into B values(4, "d")insert into B values(5, "e")insert into B values(6, "f")insert into B values(7, "g")insert into B values(8, "h")insert into A_B values (1, 1)insert into A_B values (1, 2)insert into A_B values (1, 3)insert into A_B values (1, 4)desired resultsfoobar a b c dThanks,-- Rick

View 9 Replies View Related

Columns To Rows

May 26, 2006

Lets say I have the following rows..

ID,Net,Gross,Total
1 ,25.00,55.00,100.00
2,35.00,65.00,250.00

What would be the best way to do this...

ID, Description, Value
1, Net, 25.00
1, Gross,55.00
1, Total, 100,00
2, Net 35,00

I was using the multicast and doing a bunch of derived columns but it seems like there should be a eaiser way to do this.

Any help would be appreciated, thanks.

Mardo

View 1 Replies View Related

Rows As Columns

Mar 24, 2008

Hi


i have rows as follows


1 col1 value1

1 col2 value2

1 col3 value3

2 col1 value4

2 col2 value5

2 col3 value6


need result as

id col1 col2 col3

1 value1 value2 value3

2 value4 value5 value6


How to achieve this?


I am trying to achieve this using Pivot, but it is aggregating.

View 8 Replies View Related

XML Columns To Rows

Mar 14, 2007

I have a large amount of data in an XML file. The file is very simple. Off of the root node are category nodes and each category node has many detail nodes. The detail node consist of the node name and the node value. Rather than map the detail to matching named fields in a single record, I would like to send the detail node data to individual data records where the category code, node name and node value are the only fields in the record. For example,

Starting with

<Category>

<Code>001</Code

<Details>

<DetailCode123>75.87</DetailCode123>

<DetailCode728>12.98</DetailCode728>

<DetailCode387>55.72</DetailCode387>

</Details>

</Category>

I want to be able to pick up the 001 code for the category and then transform the above data into 3 separate table records with the following fields (CatCode, DetailCodeName, DetailValue).

001, DetailCode123, 75.84

001, DetailCode728, 12.98

001, DetailCode387, 5572

Does this sort of transform exist? If not, I will have generate my own parsing script. Thought it was worth asking before doing the additional work.

Thanks

View 2 Replies View Related

Rows Into Columns

Aug 28, 2006

I am converting rows into columns :

Schedule_S1 contains more than 1 rows with different FROM_DATE and TO_DATE

The query should merge 2 rows into 1 row with 2 different FROM_DATE AND TO_DATE

The following query works fine when there are more than 1 records. When there is only 1 record, it should still return the record (with FROM_DATE_2 and TO_DATE_2 as nulls). Thanks for any help.

SELECT
ml1.P_ID,
ml1.S_ID,
ml1.CURRENT_DAY,
ml1.FROM_DATE AS "FROM_DATE_1",
ml1.TO_DATE AS "TO_DATE_1",
ml2.FROM_DATE AS "FROM_DATE_2",
ml2.TO_DATE AS "TO_DATE_2"
FROM
Schedule_S1 ml1 JOIN
Schedule_S1 ml2 ON
ml2.FROM_DATE > ml1.FROM_DATE
WHERE
ml1.P_ID = 59014 AND
ml1.S_ID = 25691 AND
ml1.CURRENT_DAY = 3 AND
ml2.P_ID = 59014 AND
ml2.S_ID = 25691 AND
ml2.CURRENT_DAY = 3
ORDER BY
ml1.FROM_DATE

View 9 Replies View Related







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