--
增加分析
set
statistics
io
on
go
set
statistics
time
on
go
set
nocount
on
go
set
showplan_text
on
go
set
showplan_All
on
go
--
--取消分析
--
--set statistics io off
--
--go
--
--set statistics time off
--
--go
--
--set nocount off
--
--go
--
--set showplan_text off
--
--go
--
--set showplan_All off
--
--go
--
執行語句
declare
@bt
datetime
set
@bt
=
getdate
()
select
*
from
productinfo
select
[
語句執行花費時間(毫秒)
]
=
datediff
(ss,
@bt
,
getdate
())
SELECT
[
P_ID
]
,
[
P_Name
]
,
[
P_Key
]
,
[
P_Order
]
,
[
P_Cate
]
,
[
P_SysCate
]
,
[
P_C_ID
]
,
[
P_C_Name
]
,
[
P_C_Order
]
,
[
P_C_Contact
]
,
[
P_C_Address
]
,
[
P_C_Tel
]
,
[
P_C_Email
]
,
[
P_C_Fax
]
,
[
P_C_Web
]
,
[
P_TopTime
]
,
[
P_InsertTime
]
,
[
P_ModifyTime
]
,
[
P_BigImage
]
,
[
P_SmallImage
]
,
[
P_User
]
,
[
P_CheckState
]
,
[
P_CheckInfo
]
,
[
P_Price
]
,
[
P_OtherState
]
FROM
[
ProductInfo
]
--
取時間的格式。
--
select CONVERT(varchar(10), getDate(),120) --不要時間2002-1-1
--
select convert(char(8),getdate(),112) ----20020101
--
select convert(char(8),getdate(),108) ---06:05:05