I need to fetch all build records with following fields, BuildName, VersionNo, BuildDate & BuildStatus from TFS_Analysis. Can someone help me to write MDX query for this.
Am unable to see BuildStatus field in TFS_Warehouse DB hence trying to get it from TFS_Analysis.
It looks a little bit like sql but the way things work are a world apart from sql. The following is complete guess work as there is not much detail in your question!...
SELECT
[Measures].[SOMEMEASUREINCUBE] ON 0
,
[BuildName].[BuildName].MEMBERS*
[VersionNo].[VersionNo].MEMBERS*
[BuildDate].[BuildDate].MEMBERS*
[BuildStatus].[BuildStatus].MEMBERS ON 1
FROM TFS_Analysis;
Related
I have an exam using SQLPlus and sometimes I don't remember the exact syntax of SQL statements, so I was wondering if there is any way to get some nice inline help from inside SQLPlus.
For instance, say I forgot how to use INSERT INTO, and I want some reminder like this:
INSERT INTO table-name (column-names)
VALUES (values)
Is this possible?
I tried HELP command but none of that seems to suits my needs.
I Googled it with no success.
No. SQL is a standardized language (at least ANSI SQL) and SQLPlus "just" uses that syntax, so it's not covered by internal help. Internal help lists only SQLPlus specific commands (ex. SET, CONNECT, SPOOL).
It is possible to workaround that in some way, but very limited. You can call dbms_metadata.get_ddl function for some existing object. Some of those DDLs could have statements you are intrested in. For example - you'd like to see select statement - then you could call dbms_metadata.get_ddl for some existing view:
select dbms_metadata.get_ddl('VIEW', 'USER_TABLES', 'SYS')
from dual;
Be aware - it works only for Oracle 11G and lower, in the newest one SYS objects are not accessible in that way (I'm not sure about Oracle 12.1).
The more interesting are tiggers, procedures, functions, and packages. You cannot use dbms_metadata to get DDLs of packages owned by SYS, but maybe you can connect to some sample schemas like HR (Human Resources), AD (Academic), SH (Sales History).
In HR schema there is stored procedure ADD_JOB_HISTORY, which has inside insert statement, so it looks like that:
select dbms_metadata.get_ddl('PROCEDURE', 'ADD_JOB_HISTORY')
from dual;
CREATE OR REPLACE EDITIONABLE PROCEDURE "HR"."ADD_JOB_HISTORY"
( p_emp_id job_history.employee_id%type
, p_start_date job_history.start_date%type
, p_end_date job_history.end_date%type
, p_job_id job_history.job_id%type
, p_department_id job_history.department_id%type
)
IS
BEGIN
INSERT INTO job_history (employee_id, start_date, end_date,
job_id, department_id)
VALUES(p_emp_id, p_start_date, p_end_date, p_job_id, p_department_id);
END add_job_history;
There are better ways and better tools to achieve your goal - see below.
Are you allowed to use SQL Developer instead of SQLPlus? SQL Developer has nice feature to drag-and-drop table icon into worksheet, then you will be nicely prompted to choose what kind of example statement you are looking for (SELECT, INSERT, UPDATE etc.) - after choosing one you will get sample statement.
But the best way is just open in browser Database SQL Language Reference:
https://docs.oracle.com/database/121/SQLRF/toc.htm
I'm looking for a way in TFS, I need to get the numbers of Code line change for individual developer between 2 dates, do you think it is doable via TFS?
Any help is appreciate, thanks!
Look in the TFS data warehouse. There is a FactCodeChurn table that should contain the data you're after.
You can use below SQL query statement:
SELECT TeamProjectProjectNodeName
,checkedinbyname
,SUM([LinesAdded]) AS
,SUM([LinesModified]) AS
,SUM([LinesAdded]+[LinesModified]) AS
,CONVERT(VARCHAR(10), MIN(DateTime),120) AS
,CONVERT(VARCHAR(10),MAX(DateTime),120) AS
FROM [Tfs_Warehouse].[dbo].[CodeChurnView] WHERE TeamProjectProjectNodeName='xxx' AND ChangesetTitle NOT LIKE 'xx' AND FilenameFileExtension IN('.css','.cs','.aspx','.sql','js','.ascx') AND (LinesDeleted <>0 OR LinesModified<>0 OR FilenameFilePath LIKE '$/XX' AND FilenameFileExtension IN('.sql')) AND NetLinesAdded>=0 GROUP BY TeamProjectProjectNodeName, checkedinbyname
ORDER BY DESC
Note: You must have permission to access the Tfs_Warehouse database to execute the above statement.
I am trying to write a plugin for SonarQube that uses the blame information provided by the SCM-Activity plugin. The problem is that, in Sonar's database, the blame information seems to either be missing or encrypted.
For example, I ran the following query against Sonar's database in MySQL Workbench:
SELECT p.kee, m.name, pm.text_value
FROM sonar.project_measures pm
JOIN sonar.snapshots s on pm.snapshot_id = s.id
JOIN sonar.metrics m on m.id = pm.metric_id
JOIN sonar.projects p on s.project_id = p.id
WHERE s.root_project_id = 1 and m.domain = 'SCM';
Here's a sample of the result:
As you can see, there are four metrics that pertain to the SCM-Activity Plugin for SonarQube:
authors_by_line
revisions_by_line
last_commit_datetimes_by_line
scm.hash
So, here are my questions:
Why is it that scm.hash is the only metric that has any value in the column text_value, and the other metrics don't? (I tried the other columns in the project_measures table, and none of them seem to have any values either.)
How do I get useful, decrypted information from the scm.hash metric? Is there a ruby method somewhere that I can use in the front end to get it? (I figure there must be, or how else is SonarQube displaying the blame info when I drill down on lines?)
If there are Ruby methods that allow retrieval and decryption of blame info, they must be located in SonarQube's source code itself, as the SCM-Activity Plugin source code seems to be devoid of any Ruby. If I am right, then where in SonarQube's source code are these Ruby methods located? I've been unable to find them.
You see NULL values in "text_value" because those metrics need so store more than just a simple line of text. So you have to join the table "MEASURE_DATA" to get the value of those measures.
Because fetch work items from wiql that is very low. I would like to fetch them from database directly but I don't know which table should I get them?
there are 9 views that are intended for creating reports in TFS 2012:
CurrentWorkItemView
WorkItemHistoryView
BuildChangesetView
BuildCoverageView
BuildDetailsView
BuildProjectView
CodeChurnView
RunCoverageView
TestResultView
Please find more info at http://blogs.msdn.com/b/granth/archive/2010/05/09/tfs2010-how-to-query-work-items-using-sql-on-the-relational-warehouse.aspx
I'm using a TClientDataSet as a local dataset without the provider concept. After working with it a method is called that should generate the corresponding SQL statements using the StatusFilter to resolve the changes (generate SQL basically).
This looked easy initially after reading documentation (set StatusFilter to [dsInsert], process all inserts SQL, set StatusFilter to [dsModified] process all updates, the same with deletes) but after a few tests now looks far from trivial, for example:
If I add a record, then edit it: setting the StatusFilter to [dsInserted] displays it, but with the original data.
If I add a record, then edit, then delete it: the record appears with StatusFilter set to [dsInserted] and [dsModified] also.
And other similar situations..
1) I know that if first I process all inserts, then all updates then all deletes the database will be updated in the correct state but it looks far from right this approach (generating useless sql statements).
2) I've tried to access the PRecInfo(ClientDataSet.ActiveBuffer + ClientDataSet.RecordSize).Attribute information (dsRecNew, dsRecOrg, etc.) but still not manage to resolve the logic.
3) I can program the logic to resolve it, for example before processing and insert, set StatusFilter to [dsDeleted], and locating by the primary key if the record to see if its deleted thereafter.. the same with edits, before inserting, checking if the record was updated after so the insert sql in the updated version and so on.. but it should be more easy..
¿Did someone tried to solve this in an elegant and straightforward way? ¿I'm missing something? Thanks