摘要:
2005与2000有点不一样,2000中可以使用sysproperties来获取描述值,而2005中已取消了.但是可以使用sys.extended_properties来获取.用法和以前一样。select TBL.name as TableName,TBL.id as TableID,COL.name as ColName,TYPE.name as Type,COL.length as Lengt... 阅读全文
摘要:
declare @row varchar(30)declare @tbname varchar(30) DECLARE string_find_cursor CURSOR FAST_FORWARD FOR SELECT [name] FROM sysobjects where type='U' and name like 'A%' ORDER BY [name] OPEN string_fi... 阅读全文
摘要:
删除重复记录,将TABLE_NAME中的不重复记录保存到#TABLE_NAME中 select distinct * into #table_name from table_name delete from table_name select * into table_name from #table_name drop table #table_name 与此相关的是“select ... 阅读全文
摘要:
一些不错的sql语句,自己根据需要收藏吧,分给多点哦:)1、说明:复制表(只复制结构,源表名:a 新表名:b) (Access可用)法一:select * into b from a where 1<>1法二:select top 0 * into b from a2、说明:拷贝表(拷贝数据,源表名:a 目标表名:b) (Access可用)insert into b(a, b, c) ... 阅读全文
摘要:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[p_search]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[p_search] GO /*--在整个数据库搜索某个字符串在哪个表的哪个字段中 /*--调用示例 ... 阅读全文