Search this insane blog:

Thursday, April 15, 2010

SSRS: What reports do I have uploaded?


/*
this refers to a linked server called myServer
if you don't have a linked server remove the text "myServer."
*/
SELECT
CASE C_1.TYPE
WHEN 2 THEN 'Report'
  WHEN 3 THEN 'Resource'  WHEN 4 THEN 'Linked Report'  WHEN 5 THEN 'Data Source' ELSE 'unknown'
  END AS TypeOfReport,

C_1.ItemID,
C_1.Path,
C_1.Name,
C_1.ParentID,
C_1.Type,
C_1.[Content],
C_1.Intermediate,
C_1.SnapshotDataID,
C_1.LinkSourceID,
C_1.Property,
C_1.Description,
C_1.Hidden,
C_1.CreatedByID,
C_1.CreationDate,
C_1.ModifiedByID,
C_1.ModifiedDate,
C_1.MimeType,
C_1.SnapshotLimit,
C_1.Parameter,
C_1.PolicyID,
C_1.PolicyRoot,
C_1.ExecutionFlag,
C_1.ExecutionTime,
R.ItemID AS Expr1,
R.Name AS Expr2,
R.id,
R.primary_rs_reports_id,
R.ManagerViewOnly,
R.HasDollars,
R.add_date
FROM nrdev1.ReportServer.dbo.Catalog AS C_1
LEFT
OUTER
JOIN admin_primary_rs_reports AS R

ON C_1.ItemID=R.ItemID
WHERE
(C_1.Path LIKE
'/%')

Thursday, March 18, 2010

HTML codes


Below is a good resource if you need to re-build information from a databaase and parse it into an http:// website address
(hint-hint.. namely Reporting Services links too!)



DECLARE @EXCLAMATION VARCHAR(20),@STAR VARCHAR(20),@SINGLE_QUOTATION VARCHAR(20),@OPEN_PARENTHESIS VARCHAR(20),@CLOSE_PARENTHESIS VARCHAR(20),@SEMI_COLON VARCHAR(20),@COLON VARCHAR(20),@AT_SIGN VARCHAR(20),@AMPERSIGN VARCHAR(20),@EQUALS VARCHAR(20),@PLUS VARCHAR(20),@DOLLAR VARCHAR(20),@FORWARD_SLASH VARCHAR(20),@QUESTION_MARK VARCHAR(20),@PERCENT VARCHAR(20),@NUMBER_SIGN VARCHAR(20),@OPEN_BRACKET VARCHAR(20),@CLOSE_BRACKET VARCHAR(20)


SELECT @EXCLAMATION =
'0.21%',--!@STAR ='%2A',--*@SINGLE_QUOTATION ='0.27%',--'@OPEN_PARENTHESIS ='0.28%',--(@CLOSE_PARENTHESIS ='0.29%',--)@SEMI_COLON ='%3B',--;@COLON ='%3A',--:@AT_SIGN ='0.4%',--@@AMPERSIGN ='0.26%',--&@EQUALS ='%3D',--=@PLUS ='%2B',--+@DOLLAR ='0.24%',--$@COMMA ='%2C',--,@FORWARD_SLASH ='%2F',--/@QUESTION_MARK ='%3F',--?@PERCENT ='0.25%',--%@NUMBER_SIGN ='0.23%',--#@OPEN_BRACKET ='%5B',--[@CLOSE_BRACKET ='%5D'--]



declare @space varchar(20),@exclamationpoint varchar(20),@doublequotes varchar(20),@numbersign varchar(20),@dollarsign varchar(20),@percentsign varchar(20),@ampersand varchar(20),@singlequote varchar(20),@openingparenthesis varchar(20),@closingparenthesis varchar(20),@asterisk varchar(20),@plussign varchar(20),@comma varchar(20),@minussignhyphen varchar(20),@period varchar(20),@slash varchar(20)
-----------------------------
set @space =' 'set @exclamationpoint='!'set @doublequotes ='"'set @numbersign ='#'set @dollarsign='set @percentsign ='%'set @ampersand ='&'set @singlequote=''''set @openingparenthesis ='('set @closingparenthesis =')'set @asterisk ='*'set @plussign ='+'set @comma =','set @minussignhyphen ='-'set @period ='.'
set @slash ='/'



set @percentsign ='%'
set @ampersand ='&'
set @singlequote=''''
set @openingparenthesis ='('
set @closingparenthesis =')'
set @asterisk ='*'
set @plussign ='+'
set @comma =','
set @minussignhyphen ='-'
set @period ='.'
set @slash ='/'

Saturday, January 9, 2010

Storing your favorite, re-usable code in SQL Server (Create an Assembly)

http://msdn.microsoft.com/en-us/library/ms189524.aspx
I am parking this link here to get back to what I want to create.
Anyone have feedback with experience creating assembly, I'm all ears.

Wednesday, December 30, 2009

Navision showing Monday as first day of week

SQL Server and English-based sql servers have Sunday as the first day of week.
Our Navision day of week is based off of Monday.
but you can set the first workday in SQL Server quite easily by setting the DATEFIRST statement

try this:
http://msdn.microsoft.com/en-us/library/ms187766(SQL.90).aspx

Navision showing Monday as first day of week

SQL Server and English-based sql servers have Sunday as the first day of week.
Our Navision day of week is based off of Monday.
go fig.
try this:
http://msdn.microsoft.com/en-us/library/ms187766(SQL.90).aspx

Tuesday, December 29, 2009

Navision Report Triggers

So far, I have data triggers and report triggers:

ONPreDataItem()
This trigger is executed before a data item is processed,
but after the associated variable is initialized and table views and filters are set.
reference: http://msdn.microsoft.com/en-us/library/dd355150.aspx

OnAfterGetRecord()
Use this trigger to calculate variables that depend on the current record. In a form with a table box,
this trigger is called for each record in the table box, as the records are updated.

OnPostDataItem()
This trigger executes after the last record in the data item is processed but before the OnPostReport Trigger or the OnPostDataPort Trigger is executed, if it is the last data item of the report or dataport.
Use this trigger to perform any cleanup or post processing needed after a data item is processed. For example, if you create a non-printing report where records are updated, you can update all the records with the modification date like this.
source: http://msdn.microsoft.com/en-us/library/dd355360.aspx

Report Triggers:
OnInitReport()
Executes when the report is loaded.

OnPreReport()
This trigger executes after the request form is run.
The table views and filters for the report data items are set while this trigger is executed.
As this trigger is executed after the request form is processed,
you have access to any filters the user has set. If you want to print the settings of these filters in the report, you can retrieve them using the following text string.

OnPostReport()
This trigger is executed after all data items are processed.
The trigger is not run if the report was stopped manually or by using the QUIT function
before processing had concluded.

Because this trigger is executed after the report is processed,
you can use it to inform users about the result of the report run.
For example, if some records could not be processed, you could inform the
user of this using the following code in this trigger.


About Hyperlinks:
OnCreateHyperLink and OnHyperLink
Ever wondered about these triggers in navision and what they are meant for. Well Navision offers a facility to create links to the different objects within it. Using this feature a hyperlink could be created for a Form in Navision from the desktop. Creation of the hyperlinks is simple open the desired Form and then use the File -> Send to option to place a hyperlink on the desktop.

When the send to desktop option is used the first thing the option does is to call the OnCreateHyperlink trigger with the URL as the parameter. The URL parameter can be modified in the trigger giving one a control over what needs to be placed in the URL string. The OnHyperLink trigger is called when the form is accessed using this link and the URL is passed in the trigger.
(source: http://santoshkmrsingh.blogspot.com/2008/11/oncreatehyperlink-and-onhyperlink.html)
OnCreateHyperlink()
http://msdn.microsoft.com/en-us/library/dd301225.aspx


ONHyperlink()
http://msdn.microsoft.com/en-us/library/dd355085.aspx

Programming Microsoft Dynamics NAV

Saturday, December 19, 2009

What is the difference between SET and SELECT variables

If you have a set, you know for sure it will return only one value.

if you use SELECT to set a variable:
select @myVariable = myTable.MyCol


or..

if you use the SET statement to set a variable

set @myVariable = myTable.MyCol


At certain times, with the SELECT statement, you can return more than one row.

That so much a problem?
Well, I think it potentially could be.
There can be no error that is returned when you get multiple rows.

here is a good source:
http://www.mssqltips.com/tip.asp?tip=1888