首頁 > 資料庫 > mysql教程 > MSSQL经典语句

MSSQL经典语句

WBOY
發布: 2016-06-07 17:57:08
原創
1037 人瀏覽過

MSSQL经典语句

Select * From TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as

select encrypt('原始密码')
select pwdencrypt('原始密码')
select pwdcompare('原始密码','加密后密码') = 1--相同;否则不相同
encrypt('原始密码')
select pwdencrypt('原始密码')
select pwdcompare('原始密码','加密后密码') = 1--相同;否则不相同

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)

EXEC master..xp_fixeddrives

if (select checksum_agg(binary_checksum(*)) from A)
=
(select checksum_agg(binary_checksum(*)) from B)
print '相等'
else
print '不相等'

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 '?'


Select Top N * From
-------------------------------
Select Top M-N * FromWhere ID in (Select Top M ID From 表) Order by ID Desc
----------------------------------

Select Top N * FromOrder by ID Desc

sp_renamedb 'old_name', 'new_name'


select Name from sysobjects where xtype='u' and status>=0

select name from syscolumns where id=object_id('表名')

select a.* from sysobjects a, syscomments b where a.id = b.id and b.text like '%表名%'


select name as 存储过程名称 from sysobjects where xtype='P'

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

select column_name,data_type from information_schema.columns
where table_name = '表名'

Select * From TableName Order By CustomerName

Select * From TableName Order By CustomerName

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板