SQL Server 2005 CTE的用法
if object_id('[tb]') is not null
drop table [tb]
go
create table [tb]([id] int,[col1] varchar(8),[col2] int)
insert [tb]
select 1,'河北省',0 union all
select 2,'邢台市',1 union all
select 3,'石家庄市',1 union all
select 4,'张家口市',1 union all
select 5,'南宫',2 union all
select 6,'坝上',4 union all
select 7,'任县',2 union all
select 8,'清河',2 union all
select 9,'河南省',0 union all
select 10,'新乡市',9 union all
select 11,'aaa',10 union all
select 12,'bbb',10
;with t as(
select * from [tb] where col1='河北省' union all select a.* from [tb] a ,t where a.col2=t.id
)
select * from t
相关文档:
说明:个人感觉在Java领域大型开发都离不了ORM的身影,所谓的SSH就是Spring+Struts+Hibernate,除了在学习基础知识的时候被告知可以使用JDBC操作数据库之外,大量的书籍中都是讲述使用Hibernate这个ORM工具来操作数据。在.NET中操作数据库的方式有多种,除了最直接的方式就是使用ADO.NET之外,还可以使用NHiber ......
今天练习在JSP页面中实现分页效果,在查询语句方面牵扯到了top的用法。简要做一下总结:
为实现类似top的功能,我们在SQL Server中和MySQL中使用到的SQL语句是不同的。
1、在SQL Server中,我们使用 select top N * ......
准备工作:数据清洗。检查数据类型和表中的字段类型是否匹配;检查空值约束;去无关空格等。这些检查工作可以通过Excel的数据筛选功能,看一下每个字段所有的值,再选中不合规范的进行修改。
步骤:
1)登录pl/sql developer,登录时选择待导入表所在数据库,在查询窗口里输入sele ......
1.直接导入数据库
shp2pgsql -s "4326" -W "GBK" E:\shape\Road_polyline.shp
road_cross| psql -U postgres -h 172.17.40.83 -d test
2.导出sql
shp2pgsql -s "4326" E:\shape\Road_polyline.shp blocks >
E:\roadcross\blocks.sql
3 ......
1修改基本表
添加列 alter table tableName add<新列名><数据类型>[完整性约束]
删除列 alter table tableName drop<新列名><数据类型>[完整性约束]
2创建
建表create table tableName(
id primary key AUTO_INCREMENT(mysql);
id primary key identity(1,1)(s ......