請問SQL Server 2000 自訂函數裏可以用 getdate()?

SQL Server 2005可以, 但SQL Server 2000不行,可以用以下折衷的方式:

Microsoft SQL討論版 – 藍色小舖 BlueShop

新增一個View,內容如下
1 CREATE VIEW dbo.VIEW1
2 AS
3 SELECT GETDATE() AS Expr1
開新視窗(view plain) | 列印(print) | ?
CREATE VIEW dbo.VIEW1 AS SELECT GETDATE() AS Expr1
自定函數如下
1 CREATE FUNCTION dbo.NowTime ()
2 RETURNS NVARCHAR(30) AS
3 BEGIN
4 RETURN (select * from view1)
5 END
開新視窗(view plain) | 列印(print) | ?
CREATE FUNCTION dbo.NowTime () RETURNS NVARCHAR(30) AS BEGIN RETURN (select * from view1) END
使用方式
1 select convert(char(10),convert(datetime,dbo

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

What is 12 + 12 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)