2012年2月2日 星期四
Truncate資料庫裡全部資料表
USE db_name
SELECT table_name into #a01 FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE='BASE TABLE'
declare @name nvarchar(1000)
declare ID1 cursor for
SELECT * FROM #a01
OPEN ID1
FETCH NEXT FROM ID1 into @name
WHILE(@@FETCH_STATUS=0)
BEGIN
IF EXISTS(SELECT * FROM SYSOBJECTS WHERE NAME=@name)
EXEC('truncate table [' + @name + ']')
FETCH NEXT FROM ID1
INTO @name
END
更改資料表的擁有者sp_changeobjectowner
語法: sp_changeobjectowner [ @objname = ] 'object', [ @newowner = ] 'owner'
範例: 將'author' 資料表擁有者變更為'george'
EXEC sp_changeobjectowner 'authors' , 'george'
http://msdn.microsoft.com/zh-tw/library/ms177519.aspx
範例: 將'author' 資料表擁有者變更為'george'
EXEC sp_changeobjectowner 'authors' , 'george'
http://msdn.microsoft.com/zh-tw/library/ms177519.aspx
2012年1月17日 星期二
將Tomcat加到Windows服務中
%TOMCAT_HOME%\bin\service install
ex: C:\Program Files\Apache Group\apache-tomcat-6.0.26\bin\service install
ex: C:\Program Files\Apache Group\apache-tomcat-6.0.26\bin\service install
2010年1月11日 星期一
2008年12月22日 星期一
Word 2003 標點符號無法於文章中使用
Word 2003 在編輯中時,於標點符號工具列中可點選標點符號按鈕,但文章中完全沒有反應。
解決方式:
1、關閉word
2、[開始] -> [執行],輸入cmd,按[Enter];開啟命令提示字元。
3、確定Word安裝的目錄,office1X
3、在視窗中輸入cd C:\program files\microsoft Office\office11\addins,完成後按[enter]鍵
4、輸入regsvr32 /u SYMINPUT.DLL 完成後,按下[Enter]鍵
5、輸入regsvr32 SYMINPUT.DLL 完成後,按下[Enter]鍵
6、開啟word後即可使用
解決方式:
1、關閉word
2、[開始] -> [執行],輸入cmd,按[Enter];開啟命令提示字元。
3、確定Word安裝的目錄,office1X
3、在視窗中輸入cd C:\program files\microsoft Office\office11\addins,完成後按[enter]鍵
4、輸入regsvr32 /u SYMINPUT.DLL 完成後,按下[Enter]鍵
5、輸入regsvr32 SYMINPUT.DLL 完成後,按下[Enter]鍵
6、開啟word後即可使用
2008年10月29日 星期三
Sum
-------
Select OrderID,ProductID,UnitPrice*Quantity*(1-Discount) as '小計'
from dbo.[Order Details]
-------
Select Convert(int,Sum(UnitPrice*Quantity*(1-Discount))) as '訂單總金額'
from dbo.[Order Details]
----
Select YEAR(OrderDate) as '年度' ,
Convert(int,Sum(UnitPrice*Quantity*(1-Discount))) as '訂單總金額'
from dbo.Orders O join dbo.[Order Details] D on O.OrderID=D.OrderID
GROUP BY YEAR(OrderDate)
------
Select YEAR(OrderDate) as '年度' ,Datepart(Quarter,OrderDate) as '季' ,
Convert(int,Sum(UnitPrice*Quantity*(1-Discount))) as '訂單總金額' ,
Count(distinct O.OrderID) as '訂單總筆數'
from dbo.Orders O join dbo.[Order Details] D on O.OrderID=D.OrderID
GROUP BY YEAR(OrderDate),Datepart(Quarter,OrderDate)
Order BY YEAR(OrderDate),Datepart(Quarter,OrderDate)
Select OrderID,ProductID,UnitPrice*Quantity*(1-Discount) as '小計'
from dbo.[Order Details]
-------
Select Convert(int,Sum(UnitPrice*Quantity*(1-Discount))) as '訂單總金額'
from dbo.[Order Details]
----
Select YEAR(OrderDate) as '年度' ,
Convert(int,Sum(UnitPrice*Quantity*(1-Discount))) as '訂單總金額'
from dbo.Orders O join dbo.[Order Details] D on O.OrderID=D.OrderID
GROUP BY YEAR(OrderDate)
------
Select YEAR(OrderDate) as '年度' ,Datepart(Quarter,OrderDate) as '季' ,
Convert(int,Sum(UnitPrice*Quantity*(1-Discount))) as '訂單總金額' ,
Count(distinct O.OrderID) as '訂單總筆數'
from dbo.Orders O join dbo.[Order Details] D on O.OrderID=D.OrderID
GROUP BY YEAR(OrderDate),Datepart(Quarter,OrderDate)
Order BY YEAR(OrderDate),Datepart(Quarter,OrderDate)
Count
use Northwind;
-----------------
Select*
from dbo.Orders
-----
Select Count(*) as '訂單總筆數'
from dbo.Orders
----
Select Count(ShippedDate) as '已出貨總筆數'
from dbo.Orders
Select YEAR(OrderDate) as '年度',Count(*) as '訂單總筆數'
from dbo.Orders
Group by YEAR(OrderDate)
------
Select YEAR(OrderDate) as '年度',Datepart(Quarter,OrderDate) as '季',Count(*) as '訂單總筆數'
from dbo.Orders
GROUP BY YEAR(OrderDate),Datepart(Quarter,OrderDate)
Order BY YEAR(OrderDate),Datepart(Quarter,OrderDate)
---return bigint(ver.2005)
Select Count_BIG(*) as '訂單總筆數'
from dbo.Orders
-----------------
Select*
from dbo.Orders
-----
Select Count(*) as '訂單總筆數'
from dbo.Orders
----
Select Count(ShippedDate) as '已出貨總筆數'
from dbo.Orders
Select YEAR(OrderDate) as '年度',Count(*) as '訂單總筆數'
from dbo.Orders
Group by YEAR(OrderDate)
------
Select YEAR(OrderDate) as '年度',Datepart(Quarter,OrderDate) as '季',Count(*) as '訂單總筆數'
from dbo.Orders
GROUP BY YEAR(OrderDate),Datepart(Quarter,OrderDate)
Order BY YEAR(OrderDate),Datepart(Quarter,OrderDate)
---return bigint(ver.2005)
Select Count_BIG(*) as '訂單總筆數'
from dbo.Orders
訂閱:
文章 (Atom)