项目中发现一批语言表的某个字段设的值太小了需要增大,因为涉及到很多张表,所以采用游标一张张的处理. 代码很简单 ) ) DECLARE LangTable CURSOR FOR SELECT name FROM sys.tables WHERE name LIKE '%Language' OPEN LangTable FETCH NEXT FROM LangTable INTO @tableName BEGIN SET @sql = 'ALTER TABLE '+@tableName+' ALT
存储过程如下: USE [SCC_Test_FileGroupAndIndex] GO /****** Object: StoredProcedure [dbo].[sp_MoveTable] Script Date: 2015/3/5 11:16:35 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /*移动表数据到别的文件组 2008-12-29*/ ALTER PROC [dbo].[sp_MoveTable]
USE [UMoney] GO /****** Object: StoredProcedure [dbo].[WCL_WorkerStatDailyWrite] Script Date: 10/08/2013 14:28:26 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ------------------------------------ --用途:根据日期生成用户个人信息日统计表并插入数据 --王朝理 --时间:2013
--显示所有用户表: --1 SELECT SCHEMA_NAME(schema_id) As SchemaName , name As TableName from sys.tables ORDER BY name --2.alternate: SELECT sch.name As SchemaName , tbl.name As TableName from sys.tables tbl inner join sys.schemas sch on tbl.schema_id = sch.sc
SQL2000系统表的应用 –1:获取当前数据库中的所有用户表 select Name from sysobjects where xtype=’u’ and status>=0 –2:获取某一个表的所有字段 select name from syscolumns where id=object_id(‘表名’) –3:查看与某一个表相关的视图.存储过程.函数 select a.* from sysobjects a, syscomments b where a.id = b.id and