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
相关文档:
例子: int id = Convert.ToInt32(replace((Request.QueryString["id"]), ""));
public static string replace(string str, string str2)
{
str = str.Replace(";", str2);
str = ......
SQL Server 2005 服务器角色和数据库角色名全解
/*服务器角色*/
sysadmin
--在 SQL Server 中进行任何活动。该角色的权限跨越所有其它固定服务器角色。
serveradmin
--配置服务器范围的设置。
setupadmin
--添加和删除链接服务器,并执行某些系统存储过程(如 sp_serveroption)。
securityadmin
--管理服务器 ......
在数据库开发过程中,当你检索的数据只是一条记录时,你所编写的事务语句代码往往使用SELECT INSERT 语句。但是我们常常会遇到这样情况,即从某一结果集中逐一地读取一条记录。那么如何解决这种问题呢?游标为我们提供了一种极为优秀的解决方案。 1.1 游标和游标的优点 在数据库中,游标是一个十分重要的概念。游标提供了一 ......
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 ......
转载:http://blog.csdn.net/cnming/archive/2009/03/11/3979290.aspx
在查询分析器中顺序执行以下三步,其中 databasename 为你的数据库文件名
1.清空日志:DUMP TRANSACTION databasename WITH NO_LOG
2.截断事务日志:BACKUP ......