Use TSQL To Create A Data Matrix

Jul 20, 2005

I am developing a SQL database to cover operations that were previously
handled in a spreadsheet, and need to create a view or procedure that
presents data into a matrix format similar to what the users are currently
working with. There must be a way I can create this using Transact SQL but
I cant figure it at this point. What the users want is for data to be
presented in 7 continuous columns where each column shows records for 1 day
of a week and each record is presented as a 'block'. Any tips or hints from
people who have achieved something similar would be gratefully accepted.

A sample of the format appears below. (Set with tabs. Hope this
translates)

1/2/2004 2/2/2004 3/2/2004 4/2/2004 5/2/2004
6/2/2004 7/2/2004
Person Smith Jones Green
Room 1A 2B 3c
Start 9:00AM 8:00AM 8:00AM
End 5:00 PM 5:00 PM 5:00 PM

Person Brown White
Room 1D 1D
Start 9:00AM 9:00AM
End 5:00 PM 5:00 PM

Person Green
Room 1M
Start 9:00AM
End 5:00 PM



Notes

1. As the diagram shows, there is likely to be a different number of records
for each day.
2. It is not necessary to have the field headings appear on the left of the
view.

View 4 Replies


ADVERTISEMENT

Matrix - Create Two Rows In A Matrix

Nov 26, 2007

Hello.
I hope to explain myself well - I want to make a matrix with two rows.
Lats say my data is this:
I hava a list of months and in every month I have a number of pepole and there age.
How can I show this in a matrix?
It need to be in a matrix since I need the columns to expand acording to the month but I don't know how to create two diffrent rows in my matrix.

The data should look like this:

10/06 11/06 12/06 01/07 02/07 03/7 04/07 .....
num 5 1 2 5 4 5 7 .....
age 16.1 25 18.5 14.8 25.5 20.5 18.5 .....

Thanks for any help.

View 3 Replies View Related

TSQL - Create A Variable Number Of Rows

May 4, 2008

I have a booking system which stores an event along with a start date and a finish date. I want to create a table which has a row for each day the event is on. I can find the number of days easily enough using a datediff function but I don't know how to translate this into that number of rows. My current thinking is to cross join the original table out to another temporary table with a large number of rows and use SQL2005 to only select the top 'x' rows, then use the rownumber of this temp table to add the required number of days to the StartDate to get each eventdate. Currently I use a loop to build the required table but there must be a way to get it all done in a single statement :)
Thanks



ORIGINAL DATA
EventID StartDate EndDate
1 1/1/08 1/1/08
2 20/1/08 22/1/08


REQUIRED DATA
EventID EventDate
1 1/1/08
2 20/1/08
2 21/1/08
2 22/1/08

View 2 Replies View Related

Why Can You Not Create A Query Notification Subscription In TSQL?

Sep 13, 2006

The title says it all. You can do it from a ADO.Net client so why not from TSQL.

It all uses the service broker stuff so why not?

View 5 Replies View Related

How To Create A Matrix Of Values From A Single Table

Aug 28, 2013

I'm a real novice user and I we use SQL Server. I have a table called TableLog that has the 4 columns. The first column is repeated x number of times for each value in the second column. I'd like to see this information put into a matrix where I could tell if there are any missing intersections. In addition, I need to insert a WHERE clause that says "BETWEEN 20090000 AND 20100000" for the first and second columns.

Example data in the table:

ID1 ID2 MRSSI
100 200 63
100 300 63
200 100 63
200 300 63
300 100 63

Desired matrix: P = Pass and F = Fail

100 200 300
100 n/a P P
200 P n/a P
300 P F P

From the example data, there's no intersection for 300 and 200 so a F is displayed.

View 3 Replies View Related

How To Create A Percent Of Variance Column In A Matrix

Jun 19, 2007

I have used SSRS 2005 to create a matrix and need to add a % of variance column. Is this possible? I hope I'm missing something simple. Basically the report should look like this:



Item CurVol PriorVol % of Var CurSales PriorSales % of Var

abc 100 90 11% 1250 990 26%

cde 96 128 -25% 192 243 -21%





Dataset looks this this:



Select item, vol, sales, 'Current' AS Per

FROM Table
WHERE (invoice_date >= @curStartDate) AND (invoice_date < @curEndDate + 1)
UNION

Select item, vol, sales, 'Prior' AS Per

FROM Table
WHERE (invoice_date >= @priorStartDate) AND (invoice_date < @priorEndDate + 1)



The column group on the matrix is using the Per column because the accounting periods cross over calendar months.





gusina




















View 4 Replies View Related

How To Create Matrix Drill Down On Report Designer

Apr 24, 2008

i'm trying to create a drill down matrix in report designer because the Chat System, i've a char in the upper region of the RDL and i want to put in the lower region a Matrix with drill down capabilities, but i don't know how to do it.

need help please
thx
Hugo

View 1 Replies View Related

TSQL - Trim String Containing Both Data And Value Into 2 Separate Data Fields

Aug 20, 2007

Hi!
Need help with this one:
I have a column with a string composed by several data. After using REPLACE several times, I get something like the data below, which has (in most of cases) a value and a date.








378 9/05

388 9/05

4/05

1/06 606

1/06 646

76 5/05

100 1/05

118 8/05

129 8/05

9/05 342

05/3 123

1/07

4/06 164
The problem is that I need to get each value alone (to separate columns), in example:
Value Date
378 09/2005
388 09/2005
0 04/2005
...
606 01/2006

and so on...
In addittion you can see that sometimes the Value come first or alone, and sometimes the Date come first or alone.

I will appreciate any good ideas,
Thanks in advance,
Aldo.


View 3 Replies View Related

Collapsing/Expanding Group Data In Table And Matrix Data Regions

May 30, 2007

Hi,



Is it possible to create Expand/Collapse functionality for the grouped data in Table and Matrix data regions? Essentially, the idea is for the user to be able to see the group/subgroup data if she wishes to by clicking on (+/-) symbols, as is usually the case in Tree View style data grid control in web apps. Any ideas how to accomplish the same in reporting services?



Thanks.

View 1 Replies View Related

Encrypting Data Using TSQL

Aug 7, 2006

I need to find a way of encrypting and decrypting data from SQL server 2000. I need to do this as transparently as possible, which is why I need to do this if at all possible before my web application encounters the data.I know this is possible without 3rd party applications using SQL server 2005, as I have a working implementation already; however I need to do this with SQL server 2000 as upgrading is not an option. Using a 3rd party product to encrypt/decrypt is also not possible.Any help much appreciated.Matt Rose

View 4 Replies View Related

How To Md5 Encrypt Data Using TSQL

Aug 3, 2007

how can i encrypt using md5 for encrypt my data using TSQL and from Enterprise Manager?

View 8 Replies View Related

Show Detail Data On A Matrix Rather Than Aggregate Data

Dec 12, 2007



Hi all experts,

I have a result set like:





Project

Milestone

Info


Project1

M1

Info1


Project1

M1

Info2


Project1

M2

Info3


Project2

M1

Info4


Project2

M2

Info5


Project3

M1

Info6


I need to create a report like:







M1

M2


Project1

Info1
Info2

Info3


Project2

Info4

Info5


Project3

Info6




But while I use matrix to build this report, I got the result like:







M1

M2


Project1

Info1

Info3


Project2

Info4

Info5


Project3

Info6




The report will not show the multiple records on the row group "Project" like item "Info2".

After I referred to the similar problem mentioned on this forums, I tried to use "RowNumber("Matrix1_Project")" to resolve it. But still I got the result like:









M1

M2


Project1

RowNumer

Info1






RowNumer

Info1






RowNumer



Info3


Project2

RowNumer

Info4






RowNumer



Info5


Project3

RowNumer

Info6



It would be much appreciated if anyone could give me some hints to complete the report I need.

Thanks in advance,
Steve Wang 2007/12/12

View 5 Replies View Related

Listing Table Data Types Using TSQL

Jun 17, 2008

I can find out the data types used in my table by navigating the SSMS and right clicking the table and selecting modify.

How do I view that same output using T-SQL?

Thank you
Goldmember

View 1 Replies View Related

TSQL Or Procedure To Compute According To Previous Data

May 19, 2008

I have three coloumn in Salary Table
Emp ID, Emp Salary , Sequence
a1 1000 1
a1 2000 2
a1 2000 3
a2 4000 1
a2 5000 2
a2 5000 3
a2 6000 4



Now I have to calculate the count on salary if the previous salary is different then count +1 else is previous salary same then add +0.
so output be
EmpID and Updation in Salary
a1 = 2 and for a2 =3

Can anyone help me with the query or storeprocedure i can achieve this output counting according to previous data.

View 9 Replies View Related

Create Table From Text File, Extract Data, Create New Table From Extracted Data....

May 3, 2004

Hello all,

Please help....

I have a text file which needs to be created into a table (let's call it DataFile table). For now I'm just doing the manual DTS to import the txt into SQL server to create the table, which works. But here's my problem....

I need to extract data from DataFile table, here's my query:

select * from dbo.DataFile
where DF_SC_Case_Nbr not like '0000%';

Then I need to create a new table for the extracted data, let's call it ExtractedDataFile. But I don't know how to create a new table and insert the data I selected above into the new one.

Also, can the extraction and the creation of new table be done in just one stored procedure? or is there any other way of doing all this (including the importation of the text file)?

Any help would be highly appreciated.

Thanks in advance.

View 3 Replies View Related

Matrix Data

Nov 12, 2007

Is there a way in matrix where i can determine if a certain field in my resultset has no value??Thanks

View 1 Replies View Related

Matrix Data

May 6, 2008



I have a stored procedure that give the (sample) data as below.

Country Category State/Province Year Month quantity
Canada cat1 AB 2008 1 10
Canada cat2 BC 2008 2 10
Canada cat3 AB 2008 3 10
Canada cat4 SK 2008 1 10
US cat1 BB 2008 1 20
US cat3 GJ 2008 2 15
US cat4 CO 2008 2 15

When I configure the matrix I EXPECT TO SEE THE FOLLOWING:




AB BC SK
2008 2008 2008
1 3 2 1
________________________________________________________________________

Canada cat1 10
cat2 10
cat3 10

cat4 10




BB GJ CO
2008 2008 2008
1 2 2
________________________________________________________________________

US cat1 20
cat3 15
cat4 15



BUT I AM GETTING THE FOLLOWING RESULT:





AB BC SK BB GJ CO
2008 2008 2008 2008 2008 2008
1 3 2 1 1 2
________________________________________________________________________

Canada cat1 10
cat2 10
cat3 10

cat4 10




BB GJ CO AB BC SK
2008 2008 2008 2008 2008 2008
1 2 2 1 3 2 1
________________________________________________________________________

US cat1 20
cat3 15
cat4 15



In Crystal it automatically displays as above. How do I do this in SRS? Matrix is not showing the state relevant to the country properly. It is showing all the states.

Thank you for your help in advance

View 5 Replies View Related

Manipulating Text,nText Data Types Filed In Tsql

Jul 12, 2006

I have to run a dynamic sql that i save in the database as a TEXT data type(due to a large size of the sql.) from a .NET app.  Now i have to run this sql from the stored proc that returns the results back to .net app. I am running this dynamic sql with sp_executesql like this..
EXEC sp_executesql @Statement,N'@param1 varchar(3),@param2 varchar(1)',@param1,@param2,GO
As i can't declare text,ntext etc variables in T-Sql(stored proc), so i am using this method in pulling the text type field "Statement".
DECLARE @Statement varbinary(16)SELECT @Statement = TEXTPTR(Statement)FROM table1 READTEXT table1.statement @Statement 0 16566
So far so good, the issue is how to convert @Statment varbinary to nText to get it passed in sp_executesql.
Note:- i can't use Exec to run the dynamic sql becuase i need to pass the params from the .net app and Exec proc doesn't take param from the stored proc from where it is called.
I would appreciate if any body respond to this.
 
 
 

View 2 Replies View Related

Matrix Displaying Data

Oct 1, 2007



I'm sorry if this is a stupid question, but this is my first matrix report.

I am using a stored procedure that generates the following data:

Item Color Size Qty
Shorts Tan 32 0
Shorts Tan 34 2
Shorts Tan 36 2
Shorts Tan 38 0

The matrix displays as follows:
34 36
Shorts Tan 2 2


I would like it to display as follows:

32 34 36 38
Shorts Tan 0 2 2 0

It seems that by default (I used the wizzard to create the report) that the zeros are being suppressed. How can I get them to display?

Thanks

View 7 Replies View Related

Two Data Sets In A Matrix

Mar 13, 2007

Hi

I have a matrix whos colunm group is filed by Dataset1,
now i want to add naother colunm group,but using the Dataset2

can I use two different dataset for a matrix,
for differnt colunm group

please help me in this regards

thanks

View 2 Replies View Related

Matrix - No Data Display NaN

May 6, 2007

Hello,



I have matrix object in reportin (SQL 2005 reporting services)

When in some field have no data it display NaN.

How can I change it ?

I try to use iif(my function = nothing.....) but didn't help

View 1 Replies View Related

Repeating Matrix Row Data

Dec 3, 2007

Hi,

I have a matrix which displays like this

Title1 A Book
Another Book

Title2 Yet another book
My Book

How can I display it like this:

Title1 A Book
Title1 Another Book

Title2 Yet another book
Title2 My Book


So that when I export this to excel I can sort and filter data easier. Thanks very much.

View 4 Replies View Related

How To Add The Subtotal For Data In A Matrix

Mar 27, 2008

Hi,

I'm having a problem to sum up the subtotal for the diff value in a datacell, group in the same rowgroup.

for eg:-

LOCATION (columngroup)
ITEM (rowgroup) AGING (rowgroup) Alaska NewYork Indianapolis -(datacell in qty)
ABC 10 5
8 8
2 10 - subtotal = 23
DEF 5 6 - subtotal = 6
GHI 9 4 4 - subtotal = 8
grand = 37

I need to know how to add in the subtotal and the grandtotal. Im using a matrix and SSRS 2000.

Besides that, is that a way to add in the header name for the ROW group in a matrix? Im currently using a normal table, aligned to the same size as the matrix, above the matrix and display the header. Is there a better way?

Thanks for the help.

View 3 Replies View Related

How To Show All Data In A Matrix

Nov 30, 2007

Hi to all


How do I can to show all data group by for one row using a matrix? Example:


Title ID

Harry Potter 0001
0002

0052
0120
Shrek 0003
0004
0050




Sorry for the English, I'm Brazilian.
Thank's for all

View 2 Replies View Related

Reporting Services :: SSRS Matrix - Add A Column In A Matrix With A Variance

Aug 6, 2015

I got the following code to add a column in a matrix with a variance:

IIF(IsNothing(Previous(Sum(Fields!Amount.Value))) or Fields!year.Value=First(Fields!year.Value,"Category") or Previous(Sum(Fields!Amount.Value))=0,nothing,
(
(Fields!Amount.Value)
/Previous(sum(Fields!Amount.Value))
)
)

This code works fine, except that the first row of the matrix shows an #error

This happens with each matrix where I use this expression. A warning emerges:

rsruntimeerrorinexpression the value expression for the textrun Textbox43.Paragraphs[0].TextRuns[0]' contains an error.

Attempted to divide by zero.

The strange thing is that the part

Fields!year.Value=First(Fields!year.Value,"Category")
should prevent an error and I expect it to show 'nothing'

An screenshot of the table. (each color is a different category. Each row stands for 2013, 2014, 2015)

As you can see, all other 2013 rows show a blank cell, except the first row.

View 3 Replies View Related

A Matrix Above Two Charts. Right Chart Moves Depending On Matrix Growth ... ???

Jan 10, 2008

I have a Matrix table that expands to the right when choosing an amount of months to be shown. Under this matrix I have to Charts. The two charts are situated together, that is no space between them, and to the left of the report.

Now, if I choose a lot of months, say three years the matrix diagram will be huge to the right. The problem I have is that the second diagram, the one on the right, moves to the right depending on how big the report gets, and this is not good at all. The two charts are supposed to be all the way to the left.

How? Why does the right chart move?

Thanks in advanced
Kind Regards

View 1 Replies View Related

How To Find Differences In Column Data Types Between Tables In Two Different Databases Using TSQL

Apr 21, 2008


I have Two Database that exist on Two seperate servers. The two database contain same schema and contains tables and columns of same name. Some tables have slight differences in terms of data types or Data type lenght.

For example if a Table on ServerA has a column named - CustomerSale with Varchar (100, Null) and a table on ServerB has a column named CustomerSale with Varchar (60, Null), how can i find if other columns have similar differences in all tables with the same name and columns in the two servers.

I am using SQL Server 2005. And the Two Servers are Linked Servers

What Script can i use to accomplish this task. Thanks






View 4 Replies View Related

Matrix Show Repeated Data

Jan 12, 2007

Hi,

i have a matrix with some fixed columns. when the fixed columns have repeated data, the repeated data is hidden.

how do you show the data all the time??

eg. i have:

Customer - Month - bikes - balls - toys - Total

Sam - January - 0 - 4 - 10 - 14

- February - 3 - 2 - 8 - 13

- March - 2 - 0 - 9 - 11

Tom - January - 2 - 5 - 2 - 9

- February - 5 - 2 - 8 - 15

- March - 1 - 6 - 3 - 10

but i want it to show like this:

Customer - Month - bikes - balls - toys - Total
Sam - January - 0 - 4 - 10 - 14
Sam - February - 3 - 2 - 8 - 13
Sam - March - 2 - 0 - 9 - 11
Tom - January - 2 - 5 - 2 - 9
Tom - February - 5 - 2 - 8 - 15
Tom - March - 1 - 6 - 3 - 10

Thanks.

View 3 Replies View Related

How To Retrieve Data From Within Collapsed Matrix

May 7, 2008

Hello,

I have a matrix which lets you drill-down by company divisions and then branches within those divisions, and the data columns show how many employees are required for each divisionranch, and how many they actually have. For example, Division 1 might have 9 / 9 for Actual / Required, but when you drill it down to Branches A and B, they may have 5 / 4 and 4 / 5 respectively. Therefore Branch A has surplus employees and Branch B has a shortfall, but at the Divisional level it looks like there are the correct number of employees.

Naturaly my customer is a bit concerned that this could be misleading data. Is there any way that I can check at the Divisional level (i.e. collapsed) whether a Branch at the expanded level has a surplus or shortage of employees? I'm not sure whether this could be resolved by redesigning the report or if it's even possible. Any ideas would be great!

Regards,
Peter Marshall

View 3 Replies View Related

Display Data From Matrix In Footer

Jun 6, 2007

I have a matrix within a list and would like to display a field value in the page footer on each page. In the page footer, if I reference a textbox from the matrix the value is always blank? I realize this is most likely a scoping issue but how can I accomplish this?



Any ideas?



Thx

View 2 Replies View Related

Data Regions Within Table/matrix Cells Are Ignored

Dec 7, 2007

My Report consists of a matrix and table . I Kept the matrix inside the table because i need to calculate subgroups total as well as Grand Total using the group i provided inside the table . The issue when i tried to render the report to Excel it shows "Data Regions within table/matrix cells are ignored." I dont know how to solve it . When i google it . It says that its a Microsoft SSRS limitation . Anyway i could solve it any help will be appreciated

Regards
Praveen John
+91-9895074288
"Frankly, my dear, I don’t give a damn"

View 1 Replies View Related

Grouping Data In Matrix Like Table Control

Jun 6, 2007

All,



Is it possible to Group data in a Matrix exactly similar to Table Control. For example, my table control would group data as follows:



Region Country City $ales

North America

USA

Chicago 4 MM

LA 10 MM

NYK 6 MM

Canada

Toronto 4 MM





while the matrix would display as:



North America USA Chicago 4MM

LA

NYK

Canada Toronto ...



Do you see the problem? The matrix is starting the subgroup at the same level as the parent group. How do I make a sub group start at the row below the parent group row in matrix just like in the table above?

View 5 Replies View Related

Matrix Data Area Conditional Formatting Off Max Value

Jan 23, 2007



I have a matrix where i'm trying to have the report select the maximum value in the data area (not including the subtotals) and bold that value.



month
day1
day2
day3
day4
total

Jan
10
15
5
12
42

Feb
5
8
3
11
27

Total
15
23
8
23
69

I'm sure i will have to use the IIF function in conjunction with the InScope function.

However i'm unsure on how to isolate to the max value and make sure the Inscope function does not affect the totals.

any idea's are appreciated.



View 3 Replies View Related







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