Posts

Showing posts with the label sql server

Log/Audit Table in Oracle and SQL SERVER

Image
Today i will explain you Why we  create Log/Audit table, How it helps us in various situations and How to create Log table and audit table. In this tutorial we will Learn  How to create Trigger  in Oracle and Sql server. In this article I use both databases Oracle and SQL Server . By creating log tables, data base automatically logging of changes to several of our database tables.

Get Client IP Address, Host name and Current User in Oracle and SQL Server

Image
Today I show how to get Client IP Address, Host name and Current Data base user in Sql Server and Oracle . It is very useful for security purposes and in case of any illegal or unauthorized activity is performed on your database so you can Track and Trace how, when  and who performed that  illegal or unauthorized activity.

Database is very slow, Why ?

Image
To Day I will Explain you  Some Reasons, why a Data base Become slow (Normally When there is more Data). In Student Life Projects we can not experience this kinds of issues because in student life Normally our Data Base may contain 10-30 tables maximum and Each table may contain 100-300 rows or above .Data base has no over head and we cannot experience Serious Issues. But What Happen when there is a data base that may have at least 900-1000 table and each table may contain 10,000- 1,000,00 or above rows then we can Faces Serious issue like Data base is Slow.... Data base Performance is not good. Data retrieval time is too high and etc. Following are some Issue which may Help you situation like above.

SQL Server 2008:How To Create User Defined Functions in SQL

Image
To day i will Show you  how to Create User defined Function SQL Server and how to Use it. I've already shared  how create Store Procedures and How to Get a Return Value From Store Procedures in SQL Server . Store Procedure ,User Define Function and User Define or User Created Views are Always Saved in the Data Base (MDF file). They are all Fast and Pre-Compiled which means we call these Functions or Store Procedures  From Our business logic layer or (Simply from Coding ) where they are Directly Executed and thus which Saves time. Difference of time saving is noticible in enviorments where you have 25-30 tables and Each table has 1,000-50,000 rows, in these Situations we Feel the Difference between In-Line Queries and Pre-Compiled SQL Statements(Store Procedure ,User Define Function and User Define or Created Views  etc).

How to reset the value of identity Column in SQL Server?

Image
Here’s a way to reset the value of the identity column in SQL Server . The scenario is explained below . For example , when the table “Customers” has an identity column with the initial value of 1 and seed 1 .Each time when you start an App and perform an operation , you might want to delete  all the records inside the table and perform the new inserts . ( Not the best of the methods , but the App had to do it ) . Now Each time I wanted to have the identity value start from 1 . The Delete statement alone is not enough to reset the identity value . After the Deletion of the records we should execute the DBCC command along with the CHECKIDENT switch along with the table name and the seed value . Like this DELETE   FROM  CUSTOMERS   DBCC CHECKIDENT (CUSTOMERS,RESEED, 0)   DELETE FROM CUSTOMERS DBCC CHECKIDENT (CUSTOMERS,RESEED, 0) Here comes a better approach , instead of using the DELETE and DBCC commands , the Truncate will do...

How to Insert Update Edit Delete Record in GridView

Image
In this example i am going to describe how to Insert record or edit or delete record in GridView using SqlDataSource. For inserting record, i've put textboxes in footer row of GridView using ItemTemplate and FooterTemplate. Go to design view of aspx page and drag a GridView control from toolbox, click on smart tag of GridView and choose new datasource Select Database and click Ok   In next screen, Enter your SqlServer name , username and password and pick Database name from the dropdown , Test the connection      In next screen, select the table name and fields , Click on Advance tab and check Generate Insert,Edit and Delete statements checkbox , alternatively you can specify your custom sql statements      Click OK to finish  Check Enable Editing , enable deleting checkbox in gridView smart tag  Now go to html source of page and define the DataKeyNames field in gridview source < asp:GridView ...

Store and Retrieve Images in Data Base using Microsoft .NET

Image
 Download Code OR DOWNLOAD CODE (Reommended) There is No Direct method To Store and Retrieve Images in Data Base Or SQL Server . But Using Following Method We Can Easily Store and Retrieve images from SQL Server . Tools Used SQL Server 2000 Microsoft .NET Version 1.1 C# (Windows Forms based application) 

Creating Reports in C# - Part 2 of 2

Description : Quick and easy way to pass parameters to reports in C#   Tools Required :   To Use this Language there is tool which created by Microsoft is Visual C# 2010 Express. To Download the Visual C# 2010 Express By Microsof t please CLICK HERE or Can also Download from Microsoft Website ANY QUERY FREE TO ASK ME

Creating Reports in C# - Part 1 of 2

Description : Quick and simple way to create report from data in SQL server, in Visual studio using C# .   Tools Required :   To Use this Language there is tool which created by Microsoft is Visual C# 2010 Express. To Download the Visual C# 2010 Express By Microsof t please CLICK HERE or Can also Download from Microsoft Website ANY QUERY FREE TO ASK ME