sql 列转化行的方法和清除日志的方法

sql 列转化行的方法

SELECT ClassId FROM Class WHERE OgId=586 and Grade=2011 select parentId=(select ParentId from Organization where Id=586), ClassId=isnull((select temp.ClassId from (select ClassId=stuff((select ','+Convert(nvarchar(10),ClassId,120) from Class where OgId=586 and Grade=2011 for xml path('')), 1, 1, '') from Class where OgId=586 and Grade=2011) temp group by temp.ClassId),'')

 

 

清除日志的方法

DUMP TRANSACTION music_test WITH NO_LOG BACKUP LOG music_test WITH NO_LOG DBCC SHRINKDATABASE(music_test)

posted @ 2014-12-25 23:11  soulfree  阅读(133)  评论(0)    收藏  举报