Archive for the ‘sqlserver’ Category

security

four aspects

1. network ID

2. log in ID

permission to log into server

modify in security->right click new logins

3. userID

permission to access database

modify in security->right click new logins

4.access permission

permission to access objects

right click database or tables->properties->permissions->search->select all object types->browse->select all->you can permissions like (select,insert…)

 

 

 

TABLE in sqlserver

There are two ways to execute your command

1. always right click to check the menu

2. new query script

some common commands:

1. CREATE TABLE TestTable

(Username CHAR(16),

Age INT)

2.ALTER TABLE TestTable

(

ADD Date DATETIME,

ALTER COLUMN Username VERCHAR(32),

DROP COLUMN Age

)

create database in sqlserver2008

method 1:

  • open sqlserver management studio
  • right click databases folder->new database

method 2:

  • new query
  • program

CREATE DATABASE Test

ON PRIMARY

( NAME=’Test_Data’,

FILENAME=’c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\Test_Data.mdf’,

SIZE=10MB,

MAXSIZE=50MB,

FILEGROWTH=5MB

)

LOG ON

( NAME=’Test_Log’,

FILENAME=’c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\Test_Log.Ldf’,

SIZE=10MB,

MAXSIZE=25MB,

FILEGROWTH=5MB

)

GO

 

if you can not see new databases in databases,reconnect server and refresh

how to install sql server 2008 management studio

when you install visual studio 2010, it contains sqlserver 2008 express, but it is a simplified version without management studio.

Solution:

  1. open sql server installation center->maintenance->edition upgrade

upgrade to “Express edition with advanced service” and next till end.

2.  run your sqlserver 2008 management studio installation file, and you can see the sql server installation center again.

3. choose installation->new sqlserver stand-alone installation or add features to an existing installation->next->add features to sqlserver 2008:sqlexpress->next you ‘ll see management tools->basic.