摘要: CREATE PROC [dbo].[usp_spFactorial]@InputValue INT,@OuputValue INT OUTPUTASBEGIN DECLARE @InValue INT; DECLARE @OutValue INT; IF(@InputValue!=0) BEGIN SET @InValue = @InputValue - 1; EXEC usp_spFactorial @InValue,@OutValue OUTPUT; ... 阅读全文
posted @ 2014-01-25 11:29 zhangsir 阅读(398) 评论(0) 推荐(0) 编辑
摘要: --查找父,包括自己CREATE PROC [dbo].[usp_spGetParentsID]@InputID INT--@ParentID UNIQUEIDENTIFIER OUTPUTASBEGIN DECLARE @strResult Nvarchar; set @strResult=''; with cte as(select ID,ParentID from Zitian_Categories where id=@InputIDunion allselect a.id,a.ParentID from Zitian_Categories a join cte b .. 阅读全文
posted @ 2014-01-25 11:28 zhangsir 阅读(181) 评论(0) 推荐(0) 编辑
摘要: --构造测试数据: 只作演示用CREATE TABLE [dbo].[Tim_LinqTable]([Id] int PRIMARY KEY IDENTITY(1,1) NOT NULL,[Name] [varchar](50) NOT NULL,[Parent] int NOT NULL,)GOINSERT INTO [Tim_LinqTable] SELECT 'A',0 UNION ALLSELECT 'A1',1 UNION ALLSELECT 'A2',1 UNION ALLSELECT 'B1',2 UNION ALL 阅读全文
posted @ 2014-01-25 11:25 zhangsir 阅读(413) 评论(0) 推荐(0) 编辑
摘要: 打开Sql server management studio并新建一个查询,在打开的XXX.SQL文件中输入:execsp_MSforeachtable @command1='Delete from ?'execsp_MSforeachtable @command1 = "TRUNCATE TABLE ?"然后执行语句。------------------------------------------------------------------------------------------如果由于外键约束删除table失败,则先删除所有约束:--/第 阅读全文
posted @ 2014-01-25 11:17 zhangsir 阅读(1445) 评论(0) 推荐(0) 编辑