Tuesday, August 22, 2017

SQL Query to listout column name From Table

Here i am discussing about the SQL Query to get the list of all column name in existing table in database.

The below query are used :


Select 
        TABLE_NAME, COLUMN_NAME 
From INFORMATION_SCHEMA.COLUMNS 
Where TABLE_NAME='table_name'

Thursday, August 10, 2017

SQL Query to create backup of single database

Here i am discussing about backup of database to specific folder of your computer drive using SQL Query.

Simply we have writing below query for backup of database:

Syntax :

USE database_name;
GO

BACKUP DATABASE database_name
TO DISK = 'path_of_folder_in_your_system_drive\database_name.Bak'
WITH FORMAT,
NAME = 'Full Backup of database_name';
GO

Example :

USE StudentRegistration;
GO 

BACKUP DATABASE StudentRegistration
TO DISK = 'D:\DBBackup\StudentRegistration_20170719.Bak'
WITH FORMAT,
NAME = 'Full Backup of StudentRegistration';
GO