Category Archives: SQL-SERVER

What is DML Command in SQL-Server?

Data Manipulation Language(DML)

DML Stands for Data Manipulation LanguageDML statements are used for managing data within schema objects. Some examples:  SELECT – Retrieve/Select data from the database
This command is used to fetch/get a result set of records from a table.

Syntax :- Select * from TableName

 

  • INSERT – insert data into a table
  • This command is used to add records to a table.

    Syntax :- Insert into TableName (Colmn1,Colmn2,…..) values (Value1,Value2,…..)

    Insert into StudemtMst (Name,Pincode) values (‘Meera’, ’383315′)

     

  • UPDATE – updates existing data within the table 
  • This command is used to edit/Update the records of a table.

    Syntax :- Update Table TableName set Colmn1=’Values’
    Update Table StudentMst set Name=’Meera’ and Pincode=’383315′

    read more

  • DML Command in SQL-Server

    Data Manipulation Language (DML)

    • DML Stands for Data Manipulation Language.
    • DML statements are used for managing data within schema objects. Some examples:
    • SELECT – Retrieve/Select data from the database
    • This command is used to fetch/get a result set of records from a table.

      Syntax :- Select * from TableName

    • INSERT – insert data into a table
    • This command is used to add records to a table.

      Syntax :- Insert into TableName (Colmn1,Colmn2,…..) values (Value1,Value2,…..)

      Insert into StudemtMst (Name,Pincode) values (‘Meera’, ’383315′)

    • UPDATE – updates existing data within the table
    • This command is used to edit/Update the records of a table.

      Syntax :- Update Table TableName set Colmn1=’Values’
      Update Table StudentMst set Name=’Meera’ and Pincode=’383315′

    • DELETE – deletes records from the table.
    • This command is used to remove/delete records from a table.

      Syntax :- Delete from TableName;
      Delete from StudentMst where ID=’5′

    read more

    DDL Command in SQL-Server.

    Data Definition Language (DDL) 

      • DDL stands for Data Definition Language.
      • DDL statements are used to define the database structure or schema.
      • It is used to create and modify the structure of database objects in database.
      •  Examples

        CREATE, ALTER, DROP statements

        1. CREATE
          - For creating databases & database objects.

        Syntax for creating database:
        CREATE DATABASE DataBaseName

      Create DataBase Students

                     Syntax for creating Table:

      CREATE TABLE StudentsMst
      (
      StudentId int,|
      StudentName varchar(50),
      StudentCity varchar(50),
      )

      2. ALTER
      - For altering/modifying the exsisting tables.

      Syntax for Altering/Adding columns:

      Alter Table TableName Add Column1 datatype,Column2 datatype,…..

           Example

      Alter Table StudentsMst Add DateOfBirth datetime,SchoolName varchar(300)

      read more

    Create a Table in SQL.

    • Below is the code / syntax to create a table in SQL,
    =&0=&

    What is SQL?

    SQL – Structured Query Language.
    • SQL stands for Structured Query Language.
    • SQL is a globally accepted standard language that is used to handle database related activities for creating database schemas, updating/inserting/deleting of data, retrievieng data, and managing user roles and database activities.

       

    • SQL is used to communicate with a database.

       

    • it is the standard language for relational database management systems. SQL statements are used to perform tasks such as update data on a database, or retrieve data from a database.

    read more

    Generate Script of Database in SQL-Server

    Script of Database in SQL-Server

    • Generate Script of Database in SQL-Server. 
    • Using Script you can get/restore the Table Column without Data. 
    • First Select the Database, which you want to generate the script. 
    • Right click on Database and select Tasks Tab and Select Generate  Script Option.
    • Database —> Tasks —-> Generate Scripts.

    • After doing this you will have a below screen, select script all object in the database option.


     
    • Below code is your script code for database backup without Data.

    read more

    How to Restore a Database Backup of SQL-Server Management Studio 2005

    Restore Database Backup of SQL -Server

    • Restore a Database Backup of SQL-Server Management Studio 2005.
    • Select the Database, which you want to Restore on it. 
    • Right click on the selected Database and go to ‘Task’ tab and select RESTORE option. 
    • Then select Database option. 
    • Database —> Tasks —->RESTORE —-> Database. 
    • After doing this you will have a below screen.
     
    •  Then Select the From device radio button from Opened windows. 
    • Then Brows the backup file of Database.

    read more

    How to create a Database Backup of SQL-Server Management Studio 2005?

    Create a Database Backup of SQL-Server

    • Create a Backup of SQL-Server Management Studio 2005.
    • Select the Database, which you want to create a backup.
    • Right click on the selected Database and go to ‘Task’ tab and select BACKUPOption.
    • After doing this you will have a below screen.

    • Select the Default Location of Database or Add new Location for Database Backup.
    • Click the OK button to get the Backup of Database.
     
    • After doing this you will get the Backup of Selected Database on Selected Location.

    read more

    How to Create new database in SQL -Server Management Studio.?

     Create new database in SQL -Server

    • Open the SQL-Server Management Studio 2005 from the Programs File.

    • Click on Connect Button to Open the Database. 
    • Right Click on the Database to Create a New Database.
    • Enter the Database name which you want to create. 
    • Then click OK button to Create New Database.
     
    •  After creating New Database you will have a below screen. 
    • Select the Database and select Table Tab to create new Table.
     
    •  For Creating New Table, Right click on the Table Tab and select New Table.

    read more

    ASP.Net with SQL-Server Connection

    • There are many method for connecting ASP.Net Application to SQL-Server.
    • We are discussing basic three method below for connection.
      Method I
      Step 1 -   Import  Namespace

                  using System.Data.Sql;

    using System.Data.SqlClient;


    Step 2 – Delcare SqlConnection
    (Make Connection between Asp.Net Application to Sql Server)
    string  strconn = “Data Source=COMPUTERNAME\\SQLEXPRESS;Initial Catalog=’DataBaseName’;Integrated Security=True”;

    SqlConnection SqlConn = new SqlConnection(strconn);


    Step 3 – Declare SqlDataAdapter
    (SqlDataAdapter is a Bridge between DataBase and DataSet/DataTable)
    SqlDataAdapter SqlAdapter = new SqlDataAdapter(“select * from Table”, SqlConn);


    Step 4 – Declare DataSet/DataTable and fill the data from DataAdapter
    DataTable DT = new DataTable();
                SqlAapter.Fill(DT);

    read more

    What is SQL Statements?

    • There are two types of SQL Statement – DML and DDL.

    • The Data Manipulation Language (DML).
    • SELECT – Select data from a database
    • UPDATE – Updates data in a database
    • DELETE – Delete data from a database
    • INSERT INTO – Inserts new data into a database.

    • The Data Definition Language (DDL).

    read more

    SQL (Structured Query Language)

    • SQL stands for Structured Query Language  


    • SQL lets you access and manipulate databases
      • SQL is a standard language for accessing databases.
      • SQL can execute queries against a database
      • SQL can retrieve data from a database
      • SQL can insert records in a database
      • SQL can update records in a database
      • SQL can delete records from a database
      • SQL can create new databases
      • SQL can create new tables in a database
      • SQL can create stored procedures in a database

      read more