随笔分类 - SqlServer
摘要:declare @var int set @var=0 while(@var<10000000) begin INSERT INTO [dbo].[AppBooks] ([Id] ,[Name] ,[Type] ,[PublishDate] ,[Price] ,[ExtraProperties] ,
阅读全文
摘要:问题:在同一个sql中,将一个数据库test后新建一个数据库覆盖还原,待还原成功的时候,test数据库一直显示“正在还原”。 在这种状态下,由于未提交的事务没有回滚,导致数据库不可以访问。 解决:执行查询restore database XXX with recovery后正常 https://ww
阅读全文
摘要:【一:行转列】插入临时数据 --插入一下临时数据源 with m as( select '张三' name,'语文'course,'89'score union all select '张三' name,'数学'course,'100'score union all select '张三' name
阅读全文
摘要:创建临时数据 with m as ( select '数字'TypeGroup,'1,2,3,4,5,6,7,8,9' info union all select '字母' TypeGroup,'a,b,c,d,e,f,g,h,i' info )select * into #temp from m
阅读全文
摘要:--插入一下临时数据源 with m as( select '张三' name,'语文'course,'89'score union all select '张三' name,'数学'course,'100'score union all select '张三' name,'英语'course,'4
阅读全文