Showing posts with label View. Show all posts
Showing posts with label View. Show all posts

Sunday 8 October 2017

MVC (Model, View and Controller)

In this post, I will explain MVC (Model, View and Controller).

MVC stands for Model, View and Controller. MVC separates an application into three components - Model, View and Controller.

Model: Model represents the shape of the data and business logic. It maintains the data of the application. Model objects retrieve and store model state in a database. Model is a data and business logic.

View: View is a user interface. View display data using the model to the user and also enables them to modify the data. View is a User Interface.

Controller: Controller handles the user request. Typically, the user interacts with View, which in-tern raises appropriate URL request, this request will be handled by a controller. The controller renders the appropriate view with the model data as a response. The controller is a request handler.

The following figure illustrates the interaction between Model, View and Controller.

Interaction between Model, View and Controller
Interaction between Model, View and Controller

Wednesday 8 March 2017

Find Stored Procedures & Views Containing Text

In this post, I will explain how to find Stored Procedures & Views with containing text in SQL server database using SQL query.

To find Stored Procedures & Views which contains given text in SQL server we need to write a query using SYS.SQL_MODULES.


DECLARE @Parameter VARCHAR(100)   
SET @Parameter = 'employee'

SELECT * 
FROM SYS.SQL_MODULES

WHERE DEFINITION LIKE '%' + @Parameter + '%'


Filter or Search SQL View using SQL Query

In this article, I will explain how to filter view with containing text in the SQL server database using SQL query.  

To filter all views which contain given text in SQL server we need to write a query using SYS.VIEWS table.


DECLARE @Parameter VARCHAR(100)
SET @Parameter = 'employee'

SELECT * FROM SYS.VIEWS            
WHERE NAME LIKE '%'+ @PARAMETER +'%'  
ORDER BY MODIFY_DATE    DESC