Click here to Skip to main content
15,893,790 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all

i want a view with below syntax

SQL
SELECT TOP 1000 [ShipToID]
      ,[StoreID]
      ,[TransactionNumber]
      ,[BatchNumber]
      ,[Time]
      ,[CustomerID]
      ,[CashierID]
      ,[Total]
      ,[SalesTax]
      ,[Comment]
      ,[ReferenceNumber]
      ,[DBTimeStamp]
      ,[Status]
      ,[ExchangeID]
      ,[ChannelType]
  FROM [RMS2].[dbo].[PUBLIC_Transaction]


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 i send [Time] as parameter to function ?
2- if question 1 possible , how do change [Time] filed with
Miladi2Shamsi
function ?

thanks a lot
Posted

1 solution

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:
SQL
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]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900