造轮子之--SQL

case when then else end用法###

http://www.cnblogs.com/prefect/p/5746624.html

查看表的数据解释###

SELECT 
c.[name] AS 字段名,
cast(ep.[value] AS varchar(100)) AS [字段说明]
FROM sys.tables AS t
INNER JOIN sys.columns AS c ON t.object_id = c.object_id
LEFT JOIN sys.extended_properties AS ep ON ep.major_id = c.object_id AND ep.minor_id = c.column_id
WHERE t.name='ComplaintLogInfoFollowUp'
AND ep.class =1

还原数据库

RESTORE DATABASE Siemens_SITL
FROM DISK = 'E:\MSSQL\Backup\Siemens_SITL.bak'
WITH MOVE 'Siemens_SITL' TO 'E:\MSSQL\Data\Siemens_SITL.mdf',
MOVE 'Siemens_SITL_log' TO 'E:\MSSQL\Data\Siemens_SITL.ldf',
STATS = 10, REPLACE
GO
posted @ 2017-10-22 17:46  jl小鱼2012  阅读(109)  评论(0编辑  收藏  举报