当前位置: 首页 > news >正文

织梦网站上传及安装建设人员变更是哪个网站

织梦网站上传及安装,建设人员变更是哪个网站,局域网里做网站,点拓网站建设已经很久没用使用这个脚本了#xff0c;今天用到#xff0c;并做修改#xff0c;增加了生成扩展属性功能。 Go if object_ID([up_CreateTable]) is not nullDrop Procedure [up_CreateTable] Go /* 生成建表脚本(V4.0) Andy 2017-3-28 */ Create Proc up_CreateTable (obje… 已经很久没用使用这个脚本了今天用到并做修改增加了生成扩展属性功能。   Go if object_ID([up_CreateTable]) is not nullDrop Procedure [up_CreateTable] Go /* 生成建表脚本(V4.0) Andy 2017-3-28 */ Create Proc up_CreateTable (objectList nvarchar(max)null ) as --With ENCRYPTION/* 参数说明objectList 对象列表对象之间使用,隔开存储过程生成的建表脚本包含Column,Constraint,Index,extended_propertiesModify: andy 2017-3-28 增加了扩展属性 */ Set Nocount OnDeclare sql nvarchar(max),objectid int,id int,Rowcount int,ObjectName sysname,Enter nvarchar(2),Tab nvarchar(2)Select EnterChar(13)Char(10),TabChar(9) Declare Tmp Table(name sysname)If objectListBeginSet sqlSelect NReplace(objectList,,, Union All Select N)Insert Into Tmp (name) Exec(sql)Set sqlnullSelect sqlIsnull(sql,,)name From Tmp As aWhere Not Exists(Select 1 From sys.objects Where typeU And namea.name)If sqlBeginSet sql发现无效的表名: sqlRaiserror (50001,-1,-1, sql)Return(1)EndEndIf object_id(tempdb..#Objects) Is Not NullDrop Table #ObjectsIf object_id(tempdb..#Columns) Is Not NullDrop Table #Columns Create Table #Objects(id int Identity(1,1) Primary Key,object_id int,name sysname);With t As(Select Object_id,Convert(int,0) As LevelNo,name As object_nameFrom sys.objects aWhere TypeU And is_ms_shipped0 And Not Exists(Select 1 From sys.foreign_keys Where referenced_object_ida.object_id)Union AllSelect a.referenced_object_id As Object_id,b.LevelNo1 As LevelNo,c.name As object_nameFrom sys.foreign_keys aInner Join t b On b.object_ida.parent_object_idInner Join sys.objects c On c.object_ida.referenced_object_id And c.is_ms_shipped0where a.referenced_object_ida.parent_object_id)Insert Into #Objects(object_id,name)Select a.object_id,object_nameFrom t aWhere Not Exists(Select 1 From t Where object_ida.object_id And LevelNoa.LevelNo) AndNot Exists(Select 1 From sys.extended_properties Where major_ida.object_id And minor_id0 And class1 And NameNmicrosoft_database_tools_support)And (Exists(Select 1 From Tmp Where namea.object_name) Or Not Exists(Select 1 From Tmp))Group By object_id,object_name,LevelNoOrder By LevelNo DescSet RowcountRowcountIf Rowcount0Begin-- Raiserror 50001 N没有可以生产脚本的表!Raiserror (50001,-1,-1, N没有可以生产脚本的表!)Return(1)End--ColumnSelect a.object_id,a.column_id As Seq,Cast(1 As tinyint) As DefinitionType,Quotename(a.name)Char(32) c.name Case When a.user_type_id In (231,239) Then (Case a.max_length When -1 Then Max Else Rtrim(a.max_length/2) End )When a.user_type_id In (62,165,167,173,175) Then (Case a.max_length When -1 Then Max Else Rtrim(a.max_length) End)When a.user_type_id In (106,108) Then (Rtrim(a.[precision]),Rtrim(a.scale)) Else End Char(32)Case a.is_rowguidcol When 1 Then Rowguidcol Else End Case a.is_identity When 1 Then Identity(Cast(d.seed_value As nvarchar(10)),Cast(d.increment_value As nvarchar(10))) Else End Case a.is_nullable When 1 Then Null Else Not Null EndIsnull(Constraint Quotename(e.name) Default(e.definition),) As definitionInto #ColumnsFrom sys.columns As aInner Join #Objects As b On b.object_ida.object_idInner Join sys.types As c On c.user_type_ida.user_type_idLeft Outer Join sys.identity_columns As d On d.object_ida.object_id And d.column_ida.column_id And a.is_identity1Left Outer Join sys.Default_constraints As e On e.object_ida.default_object_id And e.parent_column_ida.column_idCreate Nonclustered Index IX_#Columns_object_id On #Columns(object_id Asc)--ConstraintInsert Into #ColumnsSelect a.parent_object_id As object_id,Row_number() Over(Partition By a.parent_object_id Order By Case a.type When PK Then 1 When C Then 2 Else 3 End)As Seq,2 As DefinitionType,Alter Table Quotename(object_name(a.parent_object_id)) Add Constraint Quotename(a.name)Case a.type When PK Then Primary Key Case When Exists(Select 1 From sys.indexes Where object_ida.parent_object_id And is_primary_key1 And type1) Then NClustered Else NNonclustered End(Stuff((Select ,Quotename(c1.Name)Case a1.is_descending_key When 1 Then Desc Else Asc EndFrom sys.index_columns As a1Inner Join sys.indexes As b1 On b1.object_ida1.object_id And b1.index_ida1.index_id And b1.is_primary_key1Inner Join sys.columns As c1 On c1.object_ida1.object_id And c1.column_ida1.column_idWhere a1.object_ida.parent_object_id For Xml Path()),1,1,))When F Then Foreign Key (Stuff((Select ,Quotename(b1.Name)From sys.foreign_key_columns As a1Inner Join sys.columns As b1 On b1.object_ida1.parent_object_id And b1.column_ida1.parent_column_idWhere a1.constraint_object_ida.object_id Order By a1.constraint_column_idFor Xml Path()),1,1,)) References (Select Quotename(object_name(referenced_object_id)) From sys.foreign_keys Where object_ida.object_id) (Stuff((Select ,Quotename(b1.Name)From sys.foreign_key_columns As a1Inner Join sys.columns As b1 On b1.object_ida1.referenced_object_id And b1.column_ida1.referenced_column_idWhere a1.constraint_object_ida.object_id Order By a1.constraint_column_idFor Xml Path()),1,1,))When UQ Then Unique(Select Case a1.type When 1 Then Clustered Else Nonclustered EndFrom sys.indexes As a1Where a1.object_ida.parent_object_id And Exists(Select 1 From sys.key_constraints Where object_ida.object_id And parent_object_ida1.object_id And unique_index_ida1.index_id)) (Stuff((Select ,Quotename(c1.Name)Case a1.is_descending_key When 1 Then Desc Else Asc EndFrom sys.index_columns As a1Inner Join sys.indexes As b1 On b1.object_ida1.object_id And b1.index_ida1.index_id And b1.is_unique_constraint1Inner Join sys.columns As c1 On c1.object_ida1.object_id And c1.column_ida1.column_idWhere a1.object_ida.parent_object_id And Exists(Select 1 From sys.key_constraints Where object_ida.object_id And parent_object_ida1.object_id And unique_index_ida1.index_id)For Xml Path()),1,1,))When C Then Check (Select definition From sys.check_constraints Where object_ida.object_id)Else End As definitionFrom sys.objects As aWhere a.type In(PK,F,C,UQ)And Exists(Select 1 From #Objects Where object_ida.parent_object_id)--IndexInsert Into #ColumnsSelect a.object_id ,a.index_id As Seq,3 As DefinitionType,Create Case a.is_unique When 1 Then Unique Else EndCase a.type When 1 Then Clustered Else Nonclustered EndIndex Quotename(a.name) On Quotename(b.name) (Stuff((Select ,Quotename(b1.Name)Case a1.is_descending_key When 1 Then Desc Else Asc EndFrom sys.index_columns As a1Inner Join sys.columns As b1 On b1.object_ida1.object_id And b1.column_ida1.column_idWhere a1.object_ida.object_id And a.index_ida1.index_id And a1.is_included_column0For Xml Path()),1,1,))Isnull( Include(Stuff((Select ,Quotename(b1.Name)From sys.index_columns As a1Inner Join sys.columns As b1 On b1.object_ida1.object_id And b1.column_ida1.column_idWhere a1.object_ida.object_id And a.index_ida1.index_id And a1.is_included_column1For Xml Path()),1,1,)),)As definitionFrom sys.indexes As aInner Join #Objects As b On b.object_ida.object_idWhere a.type0And Not Exists(Select 1 From sys.key_constraints Where parent_object_ida.object_id And unique_index_ida.index_id)--extended_properties Andy 2017-3-28 添加扩展属性insert into #Columns select b.object_id,a.major_id as Seq,4 as DefinitionType,case a.minor_id when 0 then execute sp_addextendedproperty MS_Description,convert(nvarchar(max),a.value), user, dbo, table, quotename(b.name,)else execute sp_addextendedproperty MS_Description,convert(nvarchar(max),a.value), user, dbo, table, quotename(b.name,),column,quotename(c.name,)end from sys.extended_properties a inner join #Objects b on b.object_ida.major_idinner join sys.columns c on c.object_idb.object_idand c.column_ida.minor_idwhere a.class1--Print/*Print Use Quotename(db_name())EnterGoEnter/* 创建表结构 Andy Convert(nvarchar(10),Getdate(),120)*/EnterSet id1While idRowcountBeginSelect objectidobject_id,ObjectNamename From #Objects Where ididSet SqlEnter--(Rtrim(id)/Rtrim(Rowcount)) ObjectNameEnterIf object_id(Quotename(ObjectName)) Is NullEnterBeginEnterTabCreate Table Quotename(ObjectName)EnterTab(EnterSelect SqlSqlTabTabdefinition,EnterFrom #Columns Where object_idobjectid And DefinitionType1Group By Seq,definitionOrder By SeqSet sqlSubstring(sql,1,Len(sql)-3)EnterTab)EnterSelect SqlSqlTabdefinitionEnterFrom #Columns Where object_idobjectid And DefinitionType1Group By DefinitionType,Seq,definitionOrder By SeqPrint Substring(sql,1,Len(sql)-2)EnterEndSet idid1End*/--Modify Nr:20100510 StartDeclare MaxRow intif object_id(tempdb..#Print) Is Not NullDrop Table #PrintCreate Table #Print(Row int Identity(1,1) Primary Key,Sql nvarchar(4000))Print Use Quotename(db_name())EnterGoEnter/* 创建表结构 Andy Convert(nvarchar(10),Getdate(),120)*/EnterSet id1While idRowcountBeginSelect objectidobject_id,ObjectNamename From #Objects Where ididInsert Into #Print(Sql)Select Enter--(Rtrim(id)/Rtrim(Rowcount)) ObjectNameEnterIf object_id(Quotename(ObjectName)) Is NullEnterBeginEnterTabCreate Table Quotename(ObjectName)EnterTab(Enter Insert Into #Print(Sql)Select TabTabdefinition,EnterFrom #Columns Where object_idobjectid And DefinitionType1Group By Seq,definitionOrder By Seq Set MaxRowScope_identity()Update #PrintSet SqlSubstring(sql,1,Len(sql)-3)EnterTab)EnterWhere RowMaxRowInsert Into #Print(Sql)Select TabdefinitionEnterFrom #Columns Where object_idobjectid And DefinitionType1Group By DefinitionType,Seq,definitionOrder By Seqif ROWCOUNT 0 Set MaxRowScope_identity()Update #PrintSet Sql Substring(Sql,1,Len(Sql)-2)EnterEndWhere RowMaxRow Set idid1EndSet id1While id0BeginSet sqlSelect sqlsql From #Print Where rowidIf sqlBeginPrint sqlSet idid1endElseSet id0End--Modify Nr:20100510 EndPrint GoDrop Table #ColumnsDrop Table #ObjectsGo转载于:https://www.cnblogs.com/wghao/p/6636008.html
http://www.zqtcl.cn/news/196334/

相关文章:

  • 如何让网站做网页适配网站上的产品五星怎样做优化
  • 怎么做网站排名优化免费jq网站模板
  • 源码时代培训机构官网自己建网站怎么做seo
  • 宜都网站制作济南比较大的网站制作公司
  • 怎么用电脑做网站主机假网站怎么制作
  • 网站 微信网络营销方案设计心得
  • 淘宝客 wordpress网站wordpress类似的工具
  • 农村建设房子建设网站建设渭南房产网站制作
  • php网站开发用什么win2008 iis 新建网站
  • 中山营销网站建设杭州网站建设开发有限公司
  • 被他人备案后做违法网站抖音seo推广
  • 手机网站广告代码南靖县建设局网站
  • 郑州网站建设智巢高德地图有外资背景吗
  • 网站开发常遇到客户问题wordpress怎么升级
  • 网站的空间是网站 建设 维护 公司
  • 关于网站建设的书籍网站设计的趋势
  • 临漳+网站建设深圳国贸网站建设
  • 安全的南昌网站制作上海网站建设网
  • 360网站制作潍坊医疗网站建设方案
  • 深圳网站策划公司域名解析暂时失败
  • 怎么做安居客网站wordpress 函数文件
  • 微名片网站怎么做html代码表示
  • 两学一做纪实评价系统网站如何做好百度推广
  • 网站设置手机才能播放企业网站开发需求
  • 网站建设微信运营销售做网站用啥语言
  • dw建设网站步骤活动汪活动策划网站
  • 民和县公司网站建设网站开发的特点
  • 模板企业快速建站上传网站中ftp地址写什么
  • 云南本地企业做网站太原网站制作公司哪家好
  • 西部数码域名网站模板wordpress抓取股票行情