惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threat Research - Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Vulnerabilities – Threatpost
GbyAI
GbyAI
P
Proofpoint News Feed
L
LINUX DO - 热门话题
P
Palo Alto Networks Blog
A
About on SuperTechFans
T
Tenable Blog
M
MIT News - Artificial intelligence
IT之家
IT之家
I
Intezer
D
DataBreaches.Net
爱范儿
爱范儿
T
Threatpost
C
CERT Recently Published Vulnerability Notes
云风的 BLOG
云风的 BLOG
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
K
Kaspersky official blog
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Y
Y Combinator Blog
Cyberwarzone
Cyberwarzone
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
Spread Privacy
Spread Privacy
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
AWS News Blog
AWS News Blog
博客园 - 聂微东
C
Check Point Blog
S
Securelist
有赞技术团队
有赞技术团队
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
D
Docker
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
L
Lohrmann on Cybersecurity
G
Google Developers Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog

博客园 - 御天六龙

"AV终结者"病毒发作症状及防范措施&和杀毒有关的网页和软件都无法打开或者安装(重装系统后也一样), 如何查看表结构信息 无数据库日志文件恢复数据库方法两则 浅谈数据库设计技巧 恢复被置疑的数据库 update语句更新时我忘了限制条件了 更新了所有纪录 有办法恢复吗? 如何批量加密存储过程? SQL Server数据汇总完全解析 SQL脚本生成的一些BUG 老外对T-sql的研究:一个问题多种方法 使用ActiveX控件开发网页常见的问题 SQL Server中利用存储过程来高性能地进行分页 小记存储过程中经常用到的本周,本月,本年函数 测试用到的SQL语句 SQL Server中全角和半角字符的比较问题 配置SQL Server 2000选项 数据库主键设计之思考 SQL Sever2000绿色版,告别软件分发时安装SQL的烦恼 数据采集服务程序--ADO连续插入记录,2天后,插入速度明显变慢,求解原因?
Sql server数据库开发常用汇总
御天六龙 · 2006-08-19 · via 博客园 - 御天六龙

 

1.按姓氏筆劃排序:
Select * From TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as
2.資料庫加密:
select encrypt('原始密碼')
select pwdencrypt('原始密碼')
select pwdcompare('原始密碼','加密後密碼') = 1--相同;否則不相同 encrypt('原始密碼')
select pwdencrypt('原始密碼')
select pwdcompare('原始密碼','加密後密碼') = 1--相同;否則不相同
3.取回表中欄位:
declare @list varchar(1000),@sql nvarchar(1000)
select @list=@list+','+b.name from sysobjects a,syscolumns b where a.id=b.id and a.name='表A'
set @sql='select '+right(@list,len(@list)-1)+' from 表A'
exec (@sql)
4.查看硬碟分區:
EXEC master..xp_fixeddrives
5.比較A,B表是否相等:
if (select checksum_agg(binary_checksum(*)) from A)
=
(select checksum_agg(binary_checksum(*)) from B)
print '相等'
else
print '不相等'
6.殺掉所有的事件探察器進程:
DECLARE hcforeach CURSOR GLOBAL FOR SELECT 'kill '+RTRIM(spid) FROM master.dbo.sysprocesses
WHERE program_name IN('SQL profiler',N'SQL 事件探查器')
EXEC sp_msforeach_worker '?'
7.記錄搜索:
開頭到N條記錄
Select Top N * From 表
-------------------------------
N到M條記錄(要有主索引ID)
Select Top M-N * From 表 Where ID in (Select Top M ID From 表) Order by ID Desc
----------------------------------
N到結尾記錄
Select Top N * From 表 Order by ID Desc
8.如何修改資料庫的名稱:
sp_renamedb 'old_name', 'new_name'
9:獲取當前資料庫中的所有用戶表
select Name from sysobjects where xtype='u' and status>=0
10:獲取某一個表的所有欄位
select name from syscolumns where id=object_id('表名')
11:查看與某一個表相關的視圖、存儲過程、函數
select a.* from sysobjects a, syscomments b where a.id = b.id and b.text like '%表名%'
12:查看當前資料庫中所有存儲過程
select name as 存儲過程名稱 from sysobjects where xtype='P'
13:查詢用戶創建的所有資料庫
select * from master..sysdatabases D where sid not in(select sid from master..syslogins where name='sa')
或者
select dbid, name AS DB_NAME from master..sysdatabases where sid <> 0x01
14:查詢某一個表的欄位和資料類型
select column_name,data_type from information_schema.columns
where table_name = '表名'
[n].[標題]:
Select * From TableName Order By CustomerName
[n].[標題]:
Select * From TableName Order By CustomerName

原文地址﹕
http://www.msuniversity.edu.cn/bbs/dispbbs.asp?boardID=22&ID=392&page=1