`
kylinsoong
  • 浏览: 236216 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

SQL Server 2005 dev 学习(1)

阅读更多

关键字:SqlServer2005Dev版本安装 SQL Server Management Studio简单实用 SQLCMD运用

Part one: 安装

1. SqlServer2005 preInstallation

    先安装IIS组件,再安装.NET Framework;

    如果顺序不对,安装时可能出现如下错误:

 解决办法:

命令行模式下进入C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

执行 aspnet_regiis.exe -i

 

2. 安装

加载映像或点击.exe开始安装,个人认为三个地方需要说明:

首先如下图:



 此处可以根据需要选择,如此处我除报表外,选择了其他所有组件

 

其次,配置Service Account的时候要选Use the built-in System account(如下图)



 

还有是配置authentication mode的时候,要选择Mixed Mode,如下图(SQL Server Management Studio登陆的用户名为sa



 

到此处安装已经完成;

点击start-All programs-Micrift SqlServer 2005将会看到如下画面

 



  

 

 

 

 

 

Part two: SQL Server Management Studio

      点击start - All programs - Micrift SqlServer 2005 - SQL Server Management Studio,可以进入SQL Server Management Studio操作界面

关于SQL Server Management Studio个人理解他就是一个数据库客户端,所以他的功能我们可以想象到(管理维护服务器)

创建数据库:

 同样我们可以在Object Explore中创建表、视图、索引等

 

执行Transact-SQL



 

Note That:On the Management Studio toolbar, click Database Engine Query to open the Query Editor

 

显示查询结果

 



 

 

Part three: SQLCMD

 

The first step to using sqlcmd is starting the utility.

To start the sqlcmd utility and connect to a default instance of SQL Server

1.  Click Start, point to All Programs, point to Accessories, and then click Command Prompt.

2.  At the command prompt, type sqlcmd.

3. Press ENTER.

To terminate your sqlcmd session, type EXIT at the sqlcmd prompt.

An example to use sqlcmd(the below figure)

 

 

To connect to a named instance of SQL Server by using sqlcmd

1. Open a command prompt window, and type sqlcmd -S myServer

2. Press ENTER.

An example to connect to Local Server and search all databases(the below figure)

It is obviously that there are three added databases in Local Server.

 

Use sqlcmd to run Transact-sql

the below figure show the process of the using of Transact-sql

 Note that: in the local server, there is a database name 'test2',and in database test2 exist a table named 'test2'.

 

To run the script file

the Script file name is 'testScript.sql', located in Disk C root path, the content of  testScript.sql as following:

-----------------------Script start-----------------------------------

use test2;
go

create table test_script (
id integer                         not null ,
name varchar(200)                     null
);
go

insert into test_script values(100,'Script 100');
insert into test_script values(101,'Script 101');
insert into test_script values(102,'Script 102');
go

select * from test_script;
go

--------------------------Script end---------------------------------------

run the script file as the below figure described;

 

 

  • 大小: 6.9 KB
  • 大小: 1.6 KB
  • 大小: 12.1 KB
  • 大小: 6.9 KB
  • 大小: 55.7 KB
  • 大小: 23.8 KB
  • 大小: 28.7 KB
  • 大小: 22.7 KB
  • 大小: 4.7 KB
  • 大小: 8.7 KB
  • 大小: 15 KB
  • 大小: 3.2 KB
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics