PIXNET Logo登入

機車物語

跳到主文

var tempValue = 到底要不要說真話 ? 是 : 否 ;
List<興趣> tempList =new List<興趣>();
tempList.add(new 興趣(很多));
tempList.add(new 興趣(超級多));
想加好友的就自已提出申請吧!
但那個時候會過…看心情。

部落格全站分類:心情日記

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 2月 02 週五 201811:52
  • [MS SQL]子查詢與查詢多個資料來源

子查詢
子查詢意指巢狀結構存在於SELECT、INSERT、UPDATE、DELETE敘述中的SELECT查詢。子查詢可在巢狀子查詢 ,子查詢為join關聯資料子查詢與無關聯資料使用in(某段SELECT資料來源),在效能表現上關連子查詢會較無 關聯子查詢表現較優。
-- 使用子查詢來檢查是否符合
--關連查詢
SELECT DISTINCT s.PurchaseOrderNumber
FROM Sales.SalesOrderHeader s
WHERE EXISTS ( SELECT SalesOrderID
FROM Sales.SalesOrderDetail
WHERE UnitPrice BETWEEN 1000 AND 2000 AND
SalesOrderID = s.SalesOrderID)
--無關連子查詢
SELECT SalesPersonID,
SalesQuota CurrentSalesQuota
FROM Sales.SalesPerson
WHERE SalesQuota IN
(SELECT MAX(SalesQuota)
FROM Sales.SalesPerson)
(繼續閱讀...)
文章標籤

倧齊 發表在 痞客邦 留言(0) 人氣(27,398)

  • 個人分類:new 程式碼_Javascript(SQL)
▲top
  • 2月 02 週五 201809:48
  • [MS SQL]暫存資料表的解決方案 #TEMP TABLE


If the results table of your stored proc is too complicated to type out the "create table" statement by hand, and you can't use OPENQUERY OR OPENROWSET, you can use sp_help to generate the list of columns and data types for you. Once you have the list of columns, it's just a matter of formatting it to suit your needs.
Step 1: Add "into #temp" to the output query (e.g. "select [...] into #temp from [...]").
The easiest way is to edit the output query in the proc directly. if you can't change the stored proc, you can copy the contents into a new query window and modify the query there.
Step 2: Run sp_help on the temp table. (e.g. "exec tempdb..sp_help #temp")
After creating the temp table, run sp_help on the temp table to get a list of the columns and data types including the size of varchar fields.
Step 3: Copy the data columns & types into a create table statement
I have an Excel sheet that I use to format the output of sp_help into a "create table" statement. You don't need anything that fancy, just copy and paste into your SQL editor. Use the column names, sizes, and types to construct a "Create table #x [...]" or "declare @x table [...]" statement which you can use to INSERT the results of the stored procedure.
Step 4: Insert into the newly created table
Now you'll have a query that's like the other solutions described in this thread.
DECLARE @t TABLE
(
--these columns were copied from sp_help
COL1 INT
,
COL2 INT
)
INSERT INTO @t
Exec spMyProc

This technique can also be used to convert a temp table (#temp) to a table variable (@temp). While this may be more steps than just writing the create table statement yourself, it prevents manual error such as typos and data type mismatches in large processes. Debugging a typo can take more time than writing the query in the first place.








If you're lucky enough to have SQL 2012 or higher, you can use dm_exec_describe_first_result_set_for_object


I have just edited the sql provided by gotqn. Thanks gotqn.


This creates a global temp table with name same as procedure name. The temp table can later be used as required. Just don't forget to drop it before re-executing.


 declare @procname nvarchar(255) = 'myProcedure',
@sql nvarchar(max)
set @sql = 'create table ##' + @procname + ' ('
begin
select @sql = @sql + '[' + r.name + '] ' + r.system_type_name + ','
from sys.procedures AS p
cross apply sys.dm_exec_describe_first_result_set_for_object(p.object_id, 0) AS r
where p.name = 'myProcedure'
set @sql = substring(@sql,1,len(@sql)-1) + ')'
execute (@sql)
execute('insert ##' + @procname + ' exec ' + @procname)
end









(繼續閱讀...)
文章標籤

倧齊 發表在 痞客邦 留言(6) 人氣(2,645)

  • 個人分類:new 程式碼_Javascript(SQL)
▲top
  • 1月 27 週六 201800:38
  • 為啥嘞?

不知為啥這裡人開始多了
是不是該回來好好經營一下了嘞?
(繼續閱讀...)
文章標籤

倧齊 發表在 痞客邦 留言(1) 人氣(67)

  • 個人分類:void 查詢(){}
▲top
  • 1月 06 週一 201415:25
  • [C#]平行化作業-AsParallel

在遞迴時,有用到foreach
之前也習慣使用
結果看了幾篇文
平行運算 (一):Parallel.For、Parallel.Foreach 用法及技巧
(繼續閱讀...)
文章標籤

倧齊 發表在 痞客邦 留言(8) 人氣(2,197)

  • 個人分類:new 程式碼_Javascript(C#)
▲top
  • 12月 17 週二 201311:47
  • [jQuery][外掛]行事曆


(繼續閱讀...)
文章標籤

倧齊 發表在 痞客邦 留言(0) 人氣(989)

  • 個人分類:(new Tool()).(url)
▲top
  • 12月 17 週二 201311:45
  • [jQuery]獲取iframe內的DOM物件

☉目標:如果現在有a.html和b.html兩個網頁。b.html是以iframe的形式顯示在a.html中。我們要在a.html中,使用javascript取得b.html中的DOM元素。
a.html中的HTML:
<iframe id="iframepage" src="b.html" frameborder="0" ></iframe>
(繼續閱讀...)
文章標籤

倧齊 發表在 痞客邦 留言(0) 人氣(411)

  • 個人分類:new 程式碼_Javascript(jQuery)
▲top
  • 12月 17 週二 201311:41
  • [SQLite]免費的管理工具

sqlite_tool1
名稱:SQLite Database Browser
網站:http://sqlitebrowser.sourceforge.net/
分類:桌面程式(支援Win/Mac/Linux)
介紹:用Qt開發的Sqlite 小程式,功能相當簡單,但對於一般的資料庫建立和測試的確是夠用了。
截圖:
 
(繼續閱讀...)
文章標籤

倧齊 發表在 痞客邦 留言(0) 人氣(1,920)

  • 個人分類:(new Tool()).(url)
▲top
  • 12月 17 週二 201311:39
  • [ASP.NET][HTML]動態新增TABLE的ROW

dynamic-add-delete-row-table-javascript


<HTML>
<HEAD>
    <TITLE> Add/Remove dynamic rows in HTML table </TITLE>
    <SCRIPT language="javascript">
        function addRow(tableID) {
 
            var table = document.getElementById(tableID);
 
            var rowCount = table.rows.length;
            var row = table.insertRow(rowCount);
 
            var cell1 = row.insertCell(0);
            var element1 = document.createElement("input");
            element1.type = "checkbox";
            element1.name="chkbox[]";
            cell1.appendChild(element1);
 
            var cell2 = row.insertCell(1);
            cell2.innerHTML = rowCount + 1;
 
            var cell3 = row.insertCell(2);
            var element2 = document.createElement("input");
            element2.type = "text";
            element2.name = "txtbox[]";
            cell3.appendChild(element2);
 
 
        }
 
        function deleteRow(tableID) {
            try {
            var table = document.getElementById(tableID);
            var rowCount = table.rows.length;
 
            for(var i=0; i<rowCount; i++) {
                var row = table.rows[i];
                var chkbox = row.cells[0].childNodes[0];
                if(null != chkbox && true == chkbox.checked) {
                    table.deleteRow(i);
                    rowCount--;
                    i--;
                }
 
 
            }
            }catch(e) {
                alert(e);
            }
        }
 
    </SCRIPT>
</HEAD>
<BODY>
 
    <INPUT type="button" value="Add Row" onclick="addRow('dataTable')" />
 
    <INPUT type="button" value="Delete Row" onclick="deleteRow('dataTable')" />
 
    <TABLE id="dataTable" width="350px" border="1">
        <TR>
            <TD><INPUT type="checkbox" name="chk"/></TD>
            <TD> 1 </TD>
            <TD> <INPUT type="text" /> </TD>
        </TR>
    </TABLE>
 
</BODY>
</HTML>
(繼續閱讀...)
文章標籤

倧齊 發表在 痞客邦 留言(0) 人氣(3,571)

  • 個人分類:new 程式碼_Javascript(ASP.NET)
▲top
  • 12月 13 週五 201321:40
  • 社規

此篇文章受密碼保護,請輸入密碼後閱讀。
(繼續閱讀...)
文章標籤

倧齊 發表在 痞客邦 留言(0) 人氣(1)

  • 個人分類:亂趴連誼會社
▲top
  • 12月 05 週四 201315:19
  • [2002]中鋼-雖然賠錢也要追蹤


近四季ROE

近五年現金股利發放率

(繼續閱讀...)
文章標籤

倧齊 發表在 痞客邦 留言(0) 人氣(213)

  • 個人分類:public think 股票(){}
▲top
«123...21»

var 倧齊 = new Values();

倧齊
暱稱:
倧齊
分類:
心情日記
好友:
累積中
地區:

文章精選

熱門文章

  • (167,155)股票、美元與原油價和黃金的關係
  • (132,868)[BAT]批次檔BAT最基礎的71個指令
  • (6,668)龍星同志酒吧
  • (2,548)[ASP.NET]取得客戶端主機 IPv4 位址
  • (2,503)年化標準差Annualized Standard Deviation、貝他值Beta Coefficient、夏普值Sharp ratio
  • (1,451)[TOOL]bookmarks
  • (734)[ASP.NET]GridView的換頁
  • (299)價量關係,9種常見模式
  • (161)昨晚的歸來
  • (98)PM

文章分類

toggle 祈求平順的生活 (2)
  • void 查詢(){} (38)
  • internal void update(工作 tempValue){} (14)
toggle 裏技 (1)
  • MaxiLite-生活資產紀事 (0)
toggle 頭腦的過度運作 (14)
  • new 程式碼_Javascript(C#) (11)
  • new 程式碼_Javascript(CSS) (0)
  • new 程式碼_Javascript(VB) (0)
  • new 程式碼_Javascript(ASP.NET) (7)
  • new 程式碼_Javascript(SQL) (6)
  • new 程式碼_Javascript(Javascript) (1)
  • new 程式碼_Javascript(HTML) (1)
  • new 程式碼_Javascript(jQuery) (4)
  • new 程式碼_Javascript(AJAX) (1)
  • new 程式碼_Javascript(REG) (0)
  • new 程式碼_Javascript(IIS) (1)
  • new 程式碼_Javascript(MultiCharts) (1)
  • new 程式碼_Javascript() (3)
  • (new Tool()).(url) (5)
toggle 圈內的心酸 (3)
  • 同志 getInto(string 熊猴){} (24)
  • private void 淫(out 獸){} (10)
  • private void 十八禁(){} (1)
  • public think 股票(){} (44)
  • public void 電影(){} (28)
  • Other (3)
  • 未分類文章 (1)

Counter

參觀人氣

  • 本日人氣:
  • 累積人氣:

最新文章

  • [MS SQL]新增角色並添加執行權限
  • [Server]啟用開放分散式交易協調器( MSDTC 服務)
  • 回來看看
  • [C#]CloseXML列印設定
  • [MS SQL]取得日期區間內預設工作日
  • [MS SQL]SQL Server 2012:EOMONTH 日期函數,傳回指定日期的當月最後一天
  • [MS SQL]依現有Table產生Temp Table
  • [G漫][ぐじら]お義父さんのオンナになったボク(かわいい少年は好きですか?
  • [IIS]Content Type 大全
  • [HTML]特殊符號編碼對照表

動態訂閱

GoogleCodePrettify