Wednesday, October 10, 2012

How to format amount do not display numbers after decimal point? e.g. if the value in the database 139000.82 what function to use (other than FormatCurrency)to display amount in the SSRS 2008 R2 report such as $139,000?


Please follow the below steps to achieve the answer.




Next





Set the expressions as like below.


="Post Code:" + Fields!Post_CODE.Value +  VbCrLf  + "Area:" + Fields!AREA.Value + VbCrlf +
 "Count of Admission Number:" + cstr(Count(Fields!ADMISSION_NO.Value, "DataSet1")) + VbCrlf +
 "Estimated VALUE:" + cstr(Format(Sum(Fields!ESTIMATED_VALUE.Value, "DataSet1"),"C0")) +  VbCrLf  +
  "Averege of Each Employee VALUE:" + cstr(Format(Sum(Fields!ESTIMATED_VALUE.Value,
   "DataSet1")/Count(Fields!ADMISSION_NO.Value, "DataSet1"),"C0"))


That’s it.

How to drill through from parent report to child report in SSRS 2008 R2?


Right click the textbox and set the steps as shown below.





 Click action->Go to Report->Give Report Name->select any parameters to pass from parent report to child report.



That’s it.

How to set exception based on some amount value in % total field or Highlight anything >10% by another colour in SSRS 2008R2?


Right click the total textbox and set as like below.




Next go to backgroundcolor property of that textbox.




Set Expression as like below.




=iif( iif(iif(isnothing(Sum(Fields!Amount.Value,"Year")),0,Sum(Fields!AMOUNT.Value)/Sum(Fields!AMOUNT.Value,"Year"))=0,nothing,Sum(Fields!AMOUNT.Value)/Sum(Fields!AMOUNT.Value,"Year"))>0.1 ,"Green","White")

Thats it.

How to set Tooltip for Spark line chart in SSRS 2008R2 and how to format the amount in zero decimals?


Right click spark line chart and Go to ‘Series Property’ of Spark line and set tool tip as per below screenshot.






Set Tooltip as per the following image.






=Format(Sum(Fields!Amount.Value),"C0")

CO denotes zero decimlas value.

That's it.



How to show values of parameters chosen in the dropdown list on Textbox in the SSRS 2008 R2 report?


Drag and drop text box and go to properties--> do the steps as below.





Select the parameter from parameters category of Expression Tab and select the appropriate value
Parameters!employeer_post_code.Value
I got this by using join Join (Parameters!employeer_post_code.Value, ", ")
Finally click OK.

That’s’ it.

How do i format the currency field as £ UK pounds sterling for the entire SSRS 2008 R2 report?


Set as language properties under report properties. It should be set to English UK (en-GB) as shown below.


o/p:




Query to find who has access to a report folder or a particular report in SSRS2008 R2?


SELECT
            distinct(C.Path),
            U.UserName
FROM
            Catalog C
INNER JOIN
            PolicyUserRole PUR
            ON
            C.PolicyID = PUR.PolicyID
INNER JOIN
            Users U
            ON
            PUR.UserID = U.UserID
           
SELECT
            distinct(C.Path),
            U.UserName
FROM
            Catalog C
INNER JOIN
            PolicyUserRole PUR
            ON
            C.PolicyID = PUR.PolicyID
INNER JOIN
            Users U
            ON
            PUR.UserID = U.UserID where Path like '/POC/Farm Dashboard POC'

How to find when Microsoft going to end the support for any SQL server versions?


Please look into the below website http://support.microsoft.com/lifecycle/search/?sort=PN&alpha=SQL
Here you can search any Microsoft Products lifecycle as like below.


[Execute SQL Task] Error in SSIS Merge statement


[Execute SQL Task] Error: Executing the query "EXEC PC_Procedure_name1
EXEC PC_Procedure_name2..." failed with the following error: "The MERGE statement attempted to UPDATE or DELETE the same row more than once. This happens when a target row matches more than one source row. A MERGE statement cannot UPDATE/DELETE the same row of the target table multiple times. Refine the ON clause to ensure a target row matches at most one source row, or use the GROUP BY clause to group the source rows.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Resolution:

One of the options is presence of duplicates, before running the merge statement, please try to check the duplicates by running below query by combining more than 1 columns.
Scripts for finding duplicates by combining n number of columns
SELECT
q.KEY_FIELD,
COUNT(*)
FROM
(
SELECT
--(column1 ,column2,coulmn3)
CAST(column1 AS VARCHAR)
+CASTcolumn2 AS VARCHAR)
+CAST(coulmn3 AS VARCHAR)
 KEY_FIELD,*
 FROM Sourcetablename
 --where CAST(column1 AS VARCHAR)+CAST+CASTcolumn2 AS VARCHAR)+CAST(coulmn3 AS -----VARCHAR)='12059754183842012-08-26 00:00:00'
 ) q
 GROUP BY q.key_field
 ORDER BY COUNT(*) desc

 --307130
 SELECT COUNT(1) FROM  sourcetablename
 --10510844
 --10510844
Then change the MERGE Statement by adding one more column in the ON Clause to do perform merge.

[OLE DB Destination] Error in SSIS:

[OLE DB Destination [9]] Error: There was an error with input column
SYSTEM_DATE_TIME (130) on input "OLE DB Destination Input" (22). The column status returned was: "The
Value could not be converted because of a potential loss of data."
Resolution:
Check any invalid date value in source csv file, if yes then, change it to 01\01\1753.(Or try to change the
 Invalid date value to valid date value).

That’s all.

[SSIS.Pipeline] Error :

[SSIS.Pipeline] Warning: The output column "Columnname" (127) on output "Flat File Source Output" (2)
 and component "Flat File Source" (1) is not subsequently used in the Data Flow task. Removing this
 unused output column can increase Data Flow task performance.
Resolution:
Check the all columns in source table match with columns in destination table, if not uncheck extra column
 From the 'Available External Columns' in the Flat file Source Editor by right clicking the Flat file Source.

Database MAIL( sp_send_dbmail) Error in SQL2008 R2:


The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2012-08-31T18:10:23). Exception Message: Cannot send mails to mail server. (Mailbox unavailable. The server response was: 5.7.1 Unable to relay). 

While sending mail from SQL job through sp_send_dbmail procedure in SQL2008R2, i am getting above error.2 identical emails are send (with same distribution list and same body), with one minute of difference.

Resolution:

One of the email id in the recipients causing the above issue. So I have resolved that issue by changing the wrong mail id in the recipients list to correct mail id.

Eg .(if SMTP server related to your office smtp server. Then sp_send_dbmail will not send mail to another office server mail id in the recipients list.)

SSIS2008R2 Error: 0xC0209303 at Package:



When i trying to load data from MS access (MDB) to SQL ,i am getting the below error.

Error: 0xC0209303 at Package, Connection manager "mdbfilename": SSIS Error Code DTS_E_OLEDB_NOPROVIDER_64BIT_ERROR.  The requested OLE DB provider Microsoft.Jet.OLEDB.4.0 is not registered -- perhaps no 64-bit provider is available.  Error code: 0x00000000.
An OLE DB record is available.  Source: "Microsoft OLE DB Service Components"  Hresult: 0x80040154  Description: "Class not registered".
Error: 0xC020801C at Data Flow Task mdbfilename, OLE DB Source [1]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager " mdbfilename " failed with error code 0xC0209303.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.
Error: 0xC0047017 at Data Flow Task mdbfilename, SSIS.Pipeline: component "OLE DB Source" (1) failed validation and returned error code 0xC020801C.

Resolution:

It seems that SSIS project are now on a 64 bit machine. And that there is no 64 bit OLE DB provider Microsoft.Jet.OLEDB.4.0.So the fix is in running this project under 32 bit modes

Go to the SSIS project properties page
          à Then Click Debugging under configuration properties
          àSelect “Run64BitRuntime” property to false
          àSave the project
                              ->RUN Build again
          àThen check the package runs to a successful completion.

That's it.

How to find the SQLlogins have proper password except blank,samelogin name as password And ‘password’ as password?



--To find the blank password set for any sql logins.
--PWDCOMPARE Hashes a password and compares the hash to the    hash of an existing password.   PWDCOMPARE can be used to search for blank SQL Server login passwords or common weak passwords.

SELECT name FROM sys.sql_logins
WHERE PWDCOMPARE('', password_hash) = 1 ;

--To find the password set as like the same name of sql login name    for any sql logins.

SELECT name FROM sys.sql_logins
WHERE PWDCOMPARE(name, password_hash) = 1 ;

--To find the password set as like 'password' for sql logins

SELECT name FROM sys.sql_logins
WHERE PWDCOMPARE('password', password_hash) = 1 ;

Hope you can search for blank SQL Server login passwords or common weak passwords with above query.

MYSQL:::Seamless Data Archiving: Exporting, Importing, and Pruning MySQL Tables

  Seamless Data Archiving: Exporting, Importing, and Pruning MySQL Tables Introduction: In the dynamic landscape of database management...