MS-SQL Basics Commands
Creating a database
create database study
Database Details
sp_helpdb --Tot dbs
sp_helpdb studs --studs db details
Creating a schema
use study
go
create schema Library1
go
select * from sys.schemas --To disp all schemas
Creating a table:
create table emps(empid int,ename varchar(40),sal money)
sp_help --list all objects
sp_help emps --To disp structure of table
create table Library1.Books(bid int,bname varchar(40))
Working with data:
insert emps values(1,'Rakesh',4500),(2,'Rafi',4500)
select * from emps
update emps set sal=9000 where empid=1
dbcc log(0) --To open the log file
dbcc log(0,3) --To check complete info
delete from emps where empid=2
truncate table emps
No comments:
Post a Comment