易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL无限分类存储过程整理2

模仿参考:动易无限分类
优点:算得上是真正的无限分类,不过ParentPath是有局限性,ClassID是标识列自动增一.
缺点:新增过程中ParentID不存在还没有完善,会插入NULL数据.后面三个存储过程还在测试。
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ArticleClass]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ArticleClass]
GO
CREATE TABLE [dbo].[ArticleClass] (
 [ClassID] [int] IDENTITY (1, 1) NOT NULL ,
 [ClassName] [nvarchar] (100) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL ,
 [ParentID] [int] NULL ,
 [ParentPath] [nvarchar] (255) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL ,
 [Depth] [int] NULL ,
 [RootID] [int] NULL ,
 [Child] [int] NULL ,
 [PrevID] [int] NULL ,
 [NextID] [int] NULL ,
 [OrderID] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ArticleClass] ADD
 CONSTRAINT [DF_ArticleClass_ParentID_65E11278] DEFAULT (0) FOR [ParentID],
 CONSTRAINT [DF_ArticleClass_Depth_66D536B1] DEFAULT (0) FOR [Depth],
 CONSTRAINT [DF_ArticleClass_RootID_67C95AEA] DEFAULT (0) FOR [RootID],
 CONSTRAINT [DF_ArticleClass_Child_68BD7F23] DEFAULT (0) FOR [Child],
 CONSTRAINT [DF_ArticleClass_PrevID_69B1A35C] DEFAULT (0) FOR [PrevID],
 CONSTRAINT [DF_ArticleClass_NextID_6AA5C795] DEFAULT (0) FOR [NextID],
 CONSTRAINT [DF_ArticleClass_OrderID_6B99EBCE] DEFAULT (0) FOR [OrderID],
 CONSTRAINT [PK_ArticleClass] PRIMARY KEY  CLUSTERED
 (
  [ClassID]
 )  ON [PRIMARY]
GO
exec sp_addextendedproperty N'MS_Description', N'主键', N'user', N'dbo', N'table', N'ArticleClass', N'column', N'ClassID'
GO
exec sp_addextendedproperty N'MS_Description', N'类别名称', N'user', N'dbo', N'table', N'ArticleClass', N'column', N'ClassName'
GO
exec sp_addextendedproperty N'MS_Description', N'父类ID', N'user', N'dbo', N'table', N'ArticleClass', N'column', N'ParentID'
GO
exec sp_addextendedproperty N'MS_Description', N'父类路径', N'user',


相关文档:

Oracle中SQL PLUS的常用指令

进入sql*plus需要输入用户名、口令和主机标志符
system/manager
sys/change_on_intall
scott/tiger
internal/oracle
以上为初始密码
主机字符串空或者是@+你的服务名,在本地登陆不需要本地服务名。
下面就介绍一下一些常用的sql*plus命令:
首先查看当前使用的数据库实例:
select name from V$database;
切换两个 ......

SQL Union和Union All的使用方法

 UNION指令的目的是将两个SQL语句的结果合并起来。从这个角度来看, 我们会产生这样的感觉,UNION跟JOIN似乎有些许类似,因为这两个指令都可以由多个表格中撷取资料。 UNION的一个限制是两个 SQL 语句所产生的栏位需要是同样的资料种类。另外,当我们用 UNION这个指令时,我们只会看到不同的资料值 (类似 SELECT DISTINCT) ......

What Is SQL?

What Is SQL?
SQL (pronounced as the letters S-Q-L or as sequel) is an abbreviation for Structured Query Language. SQL is a language designed specifically for communicating with databases.
Unlike other languages (spoken languages like English, or programming languages like Java or Visual Basic), SQ ......

SQL中isnull函数的用法

语法:
   isnull(check_expression,replacement_expression)
参数check_expression与replacement_expression类型需相同
返回值:
   若check_expression为null,则返回replacement_expression
   若check_expression不为null,则返回check_expression ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号