Skip to main content

Posts

How to insert multiple rows into table

Checking the Employee table alredy exists or not.if exists droping table. IF OBJECT_ID ( 'Employee' , 'U' ) IS NOT NULL DROP TABLE Employee Ceating the  Employee  table CREATE TABLE Employee (   ID INT IDENTITY ( 1 , 1 ) PRIMARY KEY ,   NAME VARCHAR ( 20 ),   SALARY INT ) Method -1:  Here inserting only one row into Employee table INSERT INTO Employee ( NAME , SALARY ) VALUES ( 'Rakesh' , 5000 ) DELETE FROM   Employee Method -2: Here inserting multiple rows into Employee table using union all statement. INSERT INTO Employee SELECT 'Rakesh' , 5000 UNION ALL SELECT 'Ramu' , 6000 UNION ALL SELECT 'Naresh' , 7000 DELETE FROM   Employee Method -3: Here  inserting multiple rows into Employee using values statement with comma separated (2008 sql server). INSERT INTO Employee   ( NAME , SALARY )     ...

Backup Database in Sql Server

Backup data base : Backup is data base the one of the most use full task for the data base administrator’s Simple script for back up the database to disk drives: I have Adventureworks2008 data base in my sql server 2008 Syntax for backup data base: BACKUP DATABASE << Databasename >> TO DISK =<< Filename >> Script for backup data base: BACKUP DATABASE AdventureWorks2008 TO DISK = 'C:/AdventureWorks2008.BAK’ When we run above query database is back up in C drive with the AdventureWorks2008.BAK file name . When we observe the C drive Backup the data base with object explorer: Step 1: ΓΌ             Rigth click on database. go for tasks and click on Back up Step 2: When we observe above screen shot is Database :Adventureworks2008 this the name of the database which you bakup. Bakup type: backup typ...