摘要:
---(方法1)ID 不重复delete from jobs where job_id not in( select min(job_id) as job_id from jobs group by job_desc ) ---(方法2)如果ID 也重复select distinct * into #tmp from jobs --将不重复的数据插入临时表#tmpdrop table jobs -... 阅读全文
摘要:
----------------------------------------------------------------------查询一张表第15行到30行数据----------------方法1select top 10 * from jobs where job_id not in (select top 5 job_id from jobs)--方法2select * from ... 阅读全文
摘要:
--------------从旧表创建新表 , 从一张表往另外一张表导入数据------ 1. 创建表 #t1(从旧表创建新表)select descText=Max(job_desc),min_lvl=Min(min_lvl),Max_lvl=Min(Max_lvl) into #t1 from jobs group by job_desc------ 2 . #t1 表往 JOBS 导入数据 ... 阅读全文
摘要:
1. SQL Server 2000数据库字典(表结构.sql) SELECT TOP 100 PERCENT --a.id, CASE WHEN a.colorder = 1 THEN d.name ELSE '' END AS 表名, CASE WHEN a.colorder = 1 THEN isnull(f.value, '') ELSE '' END AS 表说明, a.colorder... 阅读全文
摘要:
select APP_NAME ( ) as w --当前会话的应用程序 select @@ERROR --返回最后执行的 Transact-SQL 语句的错误代码(integer) select @@IDENTITY --返回最后插入的标识值 SELECT USER_NAME() --返回用户数据库用户名 SELECT GETDATE() --当前时间 SELECT @@CPU_BUSY/100... 阅读全文