對資料構型的小測試

2021-03-31 08:56:58 字數 2207 閱讀 3218

狀態一 使用資料構型

<%

set connection = server.createobject("adodb.connection")

connectionstring = "provider=msdatashape;data provider=sqloledb.1;persist security info=true;user id=sa;password=123;initial catalog=northwind;data source=(local)"

connection.open(connectionstring)

set rs = connection.execute(sql)

do while not rs.eof

response.write(rs(0) &" - "& rs.fields.count)

response.write("

")set rschild = rs("chaporders").value

do while not rschild.eof

response.write( rschild(0) &" "& rschild(1) &" - "& rschild.fields.count)

response.write("

")rschild.movenext

loop

rschild.close

rs.movenext

loop

set rschild = nothing

rs.close

set rs = nothing

connection.close

set connection = nothing

%>

傳送如下 sql

set no_browsetable on

godeclare @p1 int

set @p1=1

exec sp_prepare @p1 output, null, n'select orderid,customerid from orders', 1

select @p1

goset no_browsetable off

goselect customerid from customers;select orderid,customerid from orders

goset no_browsetable on

goexec sp_unprepare 1

go狀態二 不使用資料構型

<%

set connection = server.createobject("adodb.connection")

connectionstring = "provider=sqloledb.1;persist security info=true;user id=sa;password=123;initial catalog=northwind;data source=(local)"

connection.open(connectionstring)

sql = "select customers.customerid, orders.orderid, orders.customerid from [customers],[orders] where customers.customerid=orders.customerid"

set rs = connection.execute(sql)

do while not rs.eof

response.write(rs(0) &" - "& rs.fields.count)

response.write("

")rs.movenext

loop

rs.close

set rs = nothing

connection.close

set connection = nothing

%>

傳送如下 sql

exec sp_reset_connection

goselect customers.customerid, orders.orderid, orders.customerid from [customers],[orders] where customers.customerid=orders.customerid

go效率就不用說了 總體來說 感覺使用性不是很大 分類和論壇結構上可能用到上

當效率是很大的問題 我寧願使用聯合查詢 配合其他方法實現同樣效果

對資料對齊的探索

有如下的兩個結構體 struct astruct b 那麼sizeof a 和sizeof b 一樣嗎?讓我在編譯器裡試一下,啊 怎麼不一樣?兩個結構體明明相同,只是第二和第三個成員變數的位置顛倒了結果卻大相徑庭。到底是因為什麼呢?答案是編譯器的資料對齊方式在作怪。以 vc6.0 為例,預設情況下的...

對資料定義的認識

sql中的ddl包括定義模式,域,關係,檢視,索引,斷言,授權等。一 sql的資料型別 有內建資料型別和使用者自定義的資料型別。一個函式 etract filed from var 從var中提取欄位filed。二 模式的定義和刪除 模式就相當於資料庫。dbms為關係的命名提供了一個3級層次結構,一...

資料取對數的意義

平時在一些資料處理中,經常會把原始資料取對數後進一步處理。之所以這樣做是基於對數函式在其定義域內是單調增函式,取對數後不會改變資料的相對關係,取對數作用主要有 1.縮小資料的絕對數值,方便計算。例如,每個資料項的值都很大,許多這樣的值進行計算可能對超過常用資料型別的取值範圍,這時取對數,就把數值縮小...

資料取對數的意義

資料取對數的意義 平時在一些資料處理中,經常會把原始資料取對數後進一步處理。之所以這樣做是基於對數函式在其定義域內是單調增函式,取對數後不會改變資料的相對關係,取對數作用主要有 縮小資料的絕對數值,方便計算。例如,每個資料項的值都很大,許多這樣的值進行計算可能對超過常用資料型別的取值範圍,這時取對數...

資料取對數的意義

平時在一些資料處理中,經常會把原始資料取對數後進一步處理。之所以這樣做是基於對數函式在其定義域內是單調增函式,取對數後不會改變資料的相對關係,取對數作用主要有 1.縮小資料的絕對數值,方便計算。例如,每個資料項的值都很大,許多這樣的值進行計算可能對超過常用資料型別的取值範圍,這時取對數,就把數值縮小...