在sql server中的view语句中按函数更改

编程入门 行业动态 更新时间:2024-10-22 21:37:59
本文介绍了在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.000

1-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语句中按函数更改

本文发布于:2023-10-07 14:21:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469628.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语句   函数   sql   server   view

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!