Monday, December 12, 2016

SQL Queries - General Admin

SQL Queries - General Admin


USE: http://extras.sqlservercentral.com/prettifier/prettifier.aspx
      for t-sql formatting

-- Query to search for a particular data type

SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE data_type ='varchar'SELECT * FROM MASTER.INFORMATION_SCHEMA.COLUMNS WHERE data_type ='varchar'


-- Query to create login
USE MASTERGOIF NOT EXISTS (SELECT FROM sys.syslogins WHERE name 'svankaya')
    
CREATE LOGIN svankaya WITH PASSWORD 'ch@ng3m3' MUST_CHANGECHECK_EXPIRATION = ONDEFAULT_DATABASE=[master] ;GOIF NOT EXISTS (SELECT FROM sys.server_role_members drm JOIN sys.server_principals mp
    
ON drm.member_principal_id mp.principal_id
    
JOIN sys.server_principals rp
    
ON rp.principal_id drm.role_principal_idWHERE rp.name 'sysadmin' AND mp.name 'svankaya')ALTER SERVER ROLE [sysadmin] ADD MEMBER [svankaya]
GO







sp_who
sp_who
2

SELECT FROM MASTER..sysprocesses
--where status = 'runnable' --comment this outORDER BY CPU
DESC-- http://whoisactive.comsp_whoisactive
  


Running Jobs

SELECT sj.name
   sja.*FROM msdb.dbo.sysjobactivity AS sja
INNER JOIN msdb.dbo.sysjobs AS sj ON sja.job_id sj.job_id
WHERE sja.start_execution_date IS NOT NULL
   AND 
sja.stop_execution_date IS NULL
 

Uncompleted Jobs

SELECT [sjv].[name][sjv].[description][sja].[run_requested_date][sja].[last_executed_step_id]
FROM [msdb].[dbo].[sysjobs_view] sjv
   JOIN [msdb].[dbo].[sysjobactivity] sja ON [sjv].[job_id] [sja].[job_id]
WHERE [sja].[run_requested_date] IS NOT NULL AND [sja].[stop_execution_date] IS NULL
 

-- Orphaned / uncompleted ... how to get only the activity for the current session
SELECT
    
job.name,
    
job.job_id,
    
job.originating_server,
    
activity.run_requested_date,
    
DATEDIFFSECONDactivity.run_requested_dateGETDATE() ) AS Elapsed
FROM     msdb.dbo.sysjobs_view job
   JOIN msdb.dbo.sysjobactivity activity ON job.job_id activity.job_id
   JOIN msdb.dbo.syssessions sess ON sess.session_id activity.session_id
   JOIN (
           
SELECT MAXagent_start_date AS max_agent_start_date
           FROM msdb.dbo.syssessions
       sess_max ON sess.agent_start_date sess_max.max_agent_start_date
WHERE run_requested_date IS NOT NULL AND stop_execution_date IS NULL
  

-- Help about particular job
EXEC msdb.dbo.sp_help_job @Job_name '-- Gives Job details, step details, schedule details, server last run details  

-- To stop job 
EXEC dbo.sp_stop_job ''






















Thursday, September 6, 2012

SSRS General tips


#. Adding Toggle (master level) as Param

     I see many reports have toggle. It will be useful to have as a parameter, to expand all toggle sections. This is apart from each section toggling.

     Have a parameter as "ToggleAll" as boolean and with default as false.

    In every textbox that has toggle functionality, use some what like ...
           
                                =Parameters!ToggleAll.Value
               

     For Table Row
               
                  
                =Not (Parameters!ToggleAll.Value)
                textbox111
            
                 

Thursday, May 3, 2012

Shortcuts and Utils needed for BI and .net Developer


Below are shortcuts and needed utils for BI and .net developer

Last Updated: May 02, 2012
Sreedhar Vankayala

Windows Shortcuts
  • To launch SQL BIDS ... Window + R (run) ... deveenv
  • File/Folder Properties ... Select file/folder and double click with mouse
  • To launch SQL Management Studio 2005 ...  Window + R (run) ... sqlwb
  • To launch SQL Management Studio 2008 ...  Window + R (run) ... ssms
  • To start/stop the sql server using cmd: net start/stop mssqlserver
Database Modelling
Utils
Videos about learning Microsoft BI

In my experience, I have not come across any other products (Non-Microsoft) having as good documentation as that of Microsoft BI (SQL Server BI) on SQL Server Books Online. Also, the support offered by Microsoft and the community through msdn forums is excellent.

SQL Utils






SSAS Tools
What frontend people are using for SSAS database?

Microsoft Excel
Microsoft Reporting Services
ProClarity
In house build Software
Panorama Novaview
SoftPro CubePlayer
Business Objects - Voyager
Strategy Companion Analyzer
Pivotview OLAP client
Intelligencia Olap Controls
Cubeslice
Dundas Controls
Radsoft
Cognos Powerplay ...


Book: Delivering Business Intelligence with Microsoft SQL Server 2005

Book: Microsoft DW in depth (bind given by Kimball group for VCH)
               Kimball group consulting / Kimball University (course material)




Thursday, April 26, 2012

Computer cleanup and todo


Page talks about frequent checks 

To do on your windows pc computer
Windows 7, Vista and XP - both 32-bit and 64-bit editions

1. Updates & Backup
        - Microsoft Updates: (if turned off, once a month)
        - Anti virus updates and scan
        - Software updates
        - Backups: Backup every day or week depending on your needs (or atleast once a month)

2. Piriform (I recommend and not part of this product or company)
CCleaner is the number-one tool for cleaning your Windows PC
Defraggler to defrag your entire hard drive, or individual files
Speccy is an advanced System Information tool for your PC
        Hard drive errors

3. Defragmenting ...

4. PDF, Flash clean up and update
Most worst is this cause the computer to slow or hack ... if you dont do for 6 months or so.

5. Remove unused programs (say if you have not used for more than 2 years and you dont feel like using in the future)

6. Buy a compressed air and clean the computer. Also use alcohol tissues to clean
         once a month or as your need ...
         Never use a home vacuum cleaner, as the static generated may cause harm or perm damage.

I think it will be better if you can backup or clean. I know we all dont have time but atleast to clean up and spend 30 minutes to make the computer happy. Dont forget to restart once a week in the minimum, it is after all Microsoft :-)

Other interesting stuff:

* http://ninite.com/
Not tested completely
But gets you many components in one page, no need to visit so many web sites
        Also gives you the list of frequent components people are using ...

* Try google for computer regular maintenance
          http://computer.lifetips.com/cat/59612/computer-maintenance-tips/index.html
          http://www.pcworld.com/article/113910/regular_maintenance.html




Eraser 6.0.10.2620 (Windows)
Topics: Encryption Software
Tags: Eraser, Hard Drive, Heidi Computers, Microsoft Windows, Operating Systems,
Pattern, Software, Solid-state Memory
Source: Heidi Computers


Eraser is an advanced security tool for Windows that allows you to completely remove sensitive data from your hard drive by overwriting it several times with carefully selected patterns.


Sreedhar: Not tried, but worth looking or to start with ...


Thursday, April 12, 2012

Tuesday, April 3, 2012

SSIS Tips

1. During the SSIS package development,
         We can consider
               Including variables and having the count of rows of important tables and details.
               
          At the end, we can provide an email task, 
          to include the following details: (Choose what is better for your reqs)

           Subject: [DBServer]: Package: [Package Name]: Success | FAILURE

           Body: 
                    Package: [Package Name] = Success | FAILURE @ Date & Time (Note: Either use here Date & Time or Started /Ended Date&Time)
                    Started: Date&Time (Optional - only use for long packages - including seconds)
                    Ended: Date&Time (Optional - only use for long packages - including seconds)
                    
                    Variables:
                          BatchID: nnnn
                          Package Exec Key: nnnn
                          DatabaseName.SchemaName.TableName: Row Count: 
                          DatabaseName.SchemaName.TableName: Row Count: 
                          FYI Variable Values: 
                          [Other Variables - including dynamic values, this will help in long term]

Thursday, June 30, 2011

Convert string into Camel Case - SSRS


Convert string into Camel Case - SSRS
You can simply use
=StrConv("MY unpropER CASE LiNe", vbProperCase)

Reference for strconv ...
http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.strings.strconv(v=VS.80).aspx



Tuesday, February 1, 2011

Design Pattern


In Software Engineering, a design pattern is a repeatable solution to a common problem occuring in software design. It is more of as description or template for how to solve the problem that can be used in different situations.

Design Pattern
- Set of guidelines
- Provided solutions for common software design problems
- Consists of one or several software design elements such as modules, interfaces, classes, objects, methods, functions, processes, threads, etc.,
- Relationships among the elements, and a behavioral description


Advantages:
- Improve the structure of software
- Simplify maintenance
- Shared language for communicating
- Separation of concerns
- Minimize logic needed in views
- Enhance testability
- Reduce development time
- Easy to customize applications

Disadvantages:
- Design pattern can be overkill in Simple UI


The Gang of Four (GoF) patterns are generally considered the foundation for all other patterns. They are categorized in three groups: Creational, Structural, and Behavioral.

GOF: ??: The authors of the DesignPatternsBook came to be known as the "Gang of Four." The name of the book ("Design Patterns: Elements of Reusable Object-Oriented Software") is too long for e-mail, so "book by the gang of four" became a shorthand name for it. After all, it isn't the ONLY book on patterns. That got shortened to "GOF book", which is pretty cryptic the first time you hear it.
  1. Erich Gamma
  2. Richard Helm
  3. Ralph Johnson
  4. John Vlissides
DESIGN PATTERN CLASSIFICATIONS
- Creational patterns
- Structural patterns
- Behavioral patterns

Creational Patterns
Abstract Factory Creates an instance of several families of classes
Builder Separates object construction from its representation
Factory Method Creates an instance of several derived classes
Prototype A fully initialized instance to be copied or cloned
Singleton A class of which only a single instance can exist

Structural Patterns
Adapter Match interfaces of different classes
Bridge Separates an object’s interface from its implementation
Composite A tree structure of simple and composite objects
Decorator Add responsibilities to objects dynamically
Facade A single class that represents an entire subsystem
Flyweight A fine-grained instance used for efficient sharing
Proxy An object representing another object

Behavioral Patterns
Chain of Resp. A way of passing a request between a chain of objects
Command Encapsulate a command request as an object
Interpreter A way to include language elements in a program
Iterator Sequentially access the elements of a collection
Mediator Defines simplified communication between classes
Memento Capture and restore an object's internal state
Observer A way of notifying change to a number of classes
State Alter an object's behavior when its state changes
Strategy Encapsulates an algorithm inside a class
Template Method Defer the exact steps of an algorithm to a subclass
Visitor Defines a new operation to a class without change

More patterns
In software engineering, concurrency patterns are those types of design patterns that deal with multi-threaded programming paradigm. Examples of this class of patterns include:

Enterprise Application Integration (EAI) is defined as the use of software and computer systems architectural principles to integrate a set of enterprise computer applications. EAI is the discipline of integrating applications and data within the enterprise into automated business processes.

The Pattern Reference Model will describe as
- Business problem.
Ex: What is the business trying to do? In this we define the scope of the problem by decomposing the business topic into logical business areas from which the requirements for business services can be defined. This allows us to identify the business services needed to solve the business problem.

- Conceptual solution.
Ex: What is the shape of the IT solution? From these services, the first sets of IT services can be deduced and defined in a conceptual solution, and their business service levels can be described in the requirements.

- Logical solution.
Ex: What IT services do we need to realize the solution? In this we refine the IT services into more granular logical components, and mechanisms that are required to create the logical solution. In doing this we evaluate alternative ways of expressing the solution and choose the one we will take forward to implement.

- Physical solution.
Ex: With what infrastructural services will the solution be created? Now the logical solution is fully converted into a hardware and software topological diagram, with products and connections defined. This does not take much account of non-functional business requirements at this time, because it is a generic pattern. However it may identify variations (different options) that would be driven by a loose description of non-functional requirements (such as "very scaleable, very resilient" versus "small, inexpensive").

- Implementation solution.
Ex: How should the Microsoft technology be implemented in the solution? Finally we show more detail about how the Microsoft technology should be implemented in the particular physical configuration.




Tuesday, November 16, 2010

BI Interview ...

BI Interview – Donald Farmer BI Perspective

Today I want to share an amazing interview done by my friend Ella Maschiach’s with the “father” of Microsoft Business Intelligence… Mr. Donald Farmer. He’s responsible for the new amazing Microsoft products like Power Pivot and Sharepoint 2010. You can’t miss this interview. Ella… why do you not follow a career also as a journalist?
ehehhehehehehe