本文介绍了在sql server中的view语句中按函数更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨所有 i想要一个语法如下的视图
hi all i want a view with below syntax
SELECT TOP 1000 [ShipToID] ,[StoreID] ,[TransactionNumber] ,[BatchNumber] ,[Time] ,[CustomerID] ,[CashierID] ,[Total] ,[SalesTax] ,[Comment] ,[ReferenceNumber] ,[DBTimeStamp] ,[Status] ,[ExchangeID] ,[ChannelType] FROM [RMS2].[dbo].[PUBLIC_Transaction]i想要在执行此视图时更改[时间]功能, 我的功能将格鲁吉亚日期转换为波斯日期 函数名称是
i want change the [Time] Filed with Function , when executing this View my function Convert Georgian Date To Persian Date function name is
Miladi2Shamsi并输入参数
And Have a Input Parameter
@EnDate(datetime,No Default)[时间]在交易表中提交的结构如下:
also [Time] Filed in the Transaction Table has Below Structure :
2002-07-01 14:51:13.0001-can我可以发送[时间]作为参数如果问题1可能,如何改变[时间]提交
1-can i send [Time] as parameter to function ? 2- if question 1 possible , how do change [Time] filed with
Miladi2Shamsi功能? 如何运作? 2- 非常感谢
function ? thanks a lot
推荐答案是的,你可以将[Time]字段值作为参数传递给函数。如果 Miladi2Shamsi 是一个用户定义的标量函数,带有一个输入参数( @EnDate ),则更改,[时间] 到此:,[dbo]。[Miladi2Shamsi]([时间])AS [时间] 查询: Hi, Yes, you can pass [Time] field value as a parameter to the function. If Miladi2Shamsi is a user-defined scalar function with one input parameter (@EnDate), then change ,[Time] to this: ,[dbo].[Miladi2Shamsi]([Time]) AS [Time] Query: SELECT TOP 1000 [ShipToID] ,[StoreID] ,[TransactionNumber] ,[BatchNumber] ,[dbo].[Miladi2Shamsi]([Time]) AS [Time] ,[CustomerID] ,[CashierID] ,[Total] ,[SalesTax] ,[Comment] ,[ReferenceNumber] ,[DBTimeStamp] ,[Status] ,[ExchangeID] ,[ChannelType] FROM [RMS2].[dbo].[PUBLIC_Transaction]
更多推荐
在sql server中的view语句中按函数更改
发布评论