网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

关于写sqlserver的信息

如何写sqlserver的ini配置文件

uses

成都创新互联专注于双牌企业网站建设,响应式网站开发,成都商城网站开发。双牌网站建设公司,为双牌等地区提供建站服务。全流程按需策划设计,专业设计,全程项目跟踪,成都创新互联专业和态度为您提供的服务

Inifile;

var

ini:tinifile;

SqlServer,Sqlusr,SqlPwd:string;

begin

ini:=tinifile.create('My.ini');

SqlServer

:=ini.ReadString('Server','SqlServer','');

//读取INI配置文件服务器IP地址

Sqlusr

:=ini.ReadString('Server','Sqlusr','');

//读取INI配置文件SQL账号

SqlPwd

:=ini.ReadString('Server','Sqlpwd','');

//读取INI配置文件SQL密码

//然后使用ADOquery将账号密码加入后连接就可以了

end;

ini配置文件:

[Server]

SqlServer=127.0.0.1

Sqlusr=sa

Sqlpwd=123456

SQLServer 语句怎么写

嵌套比较多,你慢慢看。

select D.address, D.time, D.value

from (select A.address, A.time, A.value

from A

union

select B.address, B.time, B.value

from B) D,

(select C.Address, max(C.time) as maxTime

from (select A.address, A.time, A.value

from A

union

select B.address, B.time, B.value

from B) C

group by C.address) E

where D.address = E.address

and D.time = E.maxTime

编写一个SQLSERVER 存储过程

代码是最好的文字,不多说,请看我的代码,并给分,呵呵。

--step1. 建表

if exists(select * from sysobjects where id=object_id('student') and objectproperty(id,'IsTable')=1)

drop table student

go

create table student

(

id int identity(100,10) not null

,sname varchar(10) not null

,sno varchar(30) not null

)

go

--step2.建存储过程

if exists(select * from sysobjects where id=object_id('proc_demo') and objectproperty(id,'IsProcedure')=1)

drop procedure proc_demo

go

create procedure proc_demo

@o_maxid int output

as

set nocount on

--如果希望大小写敏感,使用第一句,因为SQL Server默认是大小写不敏感的

--update student set sno='cay_'+sno where ascii(substring(sname,1,1))=87 and ascii(substring(sname,2,1))=65 and sno not like 'cay_%'

update student set sno='cay_'+sno where sname like 'WA%' and sno not like 'cay_%'

print convert(varchar(10),@@rowcount)+'条记录符合条件并被处理'

select @o_maxid=max(id) from student where id=100

if(@o_maxid is null) print '没有找到符合条件的最大记录'

set nocount off

go

--测试数据1

truncate table student

set identity_insert student on

insert into student(id,sname,sno)values(1,'WA1','1');

insert into student(id,sname,sno)values(2,'wa2','2');

insert into student(id,sname,sno)values(3,'3','3');

set identity_insert student off

go

--测试数据2

truncate table student

insert into student(sname,sno)values('WA1','1');

insert into student(sname,sno)values('wa2','2');

insert into student(sname,sno)values('3','3');

go

--测试过程

declare @maxid int

exec proc_demo @maxid out

print '最大id是'+convert(varchar(10),@maxid)

go


本文题目:关于写sqlserver的信息
文章位置:http://bjjierui.cn/article/dsdphcj.html

其他资讯