SQLServer存儲進程中事務的應用辦法。本站提示廣大學習愛好者:(SQLServer存儲進程中事務的應用辦法)文章只能為提供參考,不一定能成為您想要的結果。以下是SQLServer存儲進程中事務的應用辦法正文
以下的現實例子代碼可以將查詢的成果放入到一張自界說表中,同時可以再從這個自界說的表中查詢數據:
with AA as (SELECT TICKETNUMBER, TICKETTYPE, VERSIONNUMBER, STAGENAME, DTANALYZED, GISPROCESSID, PROCESSSTATUS, DTRECEIVED, USERID, USERNAME, FIRSTNAME, LASTNAME, NUMBEROFDAYS FROM REPORT_PERFORMANCEOFANALYZER WHERE (DTANALYZED IS NULL) UNION ALL SELECT TICKETNUMBER, TICKETTYPE, VERSIONNUMBER, STAGENAME, DTANALYZED, GISPROCESSID, PROCESSSTATUS, DTRECEIVED, USERID, USERNAME, FIRSTNAME, LASTNAME, NUMBEROFDAYS FROM REPORT_PERFORMANCEOFANALYZER REPORT_PERFORMANCEOFANALYZER_1) SELECT TICKETNUMBER, TICKETTYPE, VERSIONNUMBER, STAGENAME, DTANALYZED, GISPROCESSID, PROCESSSTATUS, DTRECEIVED, USERID, USERNAME, FIRSTNAME, LASTNAME, NUMBEROFDAYS, (SELECT COUNT(GISPROCESSID) AS COUNTTICKETS FROM AA) COUNTTICKETS FROM AA ORDER BY USERNAME;