Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7916227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:43:48+00:00 2026-06-03T14:43:48+00:00

I have a procedure returning the datetime of a particular timeZone . CREATE Function

  • 0

I have a procedure returning the datetime of a particular timeZone .

CREATE Function [dbo].GetMyDate()  
Returns DATETIME  
As  
Begin  
 Return DateAdd(Hour,1,GetUTCDATE())  
End  

If I call it two or three times in ONE T-SQL statement, will it give me the exactly same timestamp??
Or will it return different timestamps??

For eg,

SELECT 1 FROM TABLE_A WHERE GetMyDate() between GetMyDate() AND GetMyDate()

If I execute the above statement, will it always give “1” ??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:43:51+00:00Added an answer on June 3, 2026 at 2:43 pm

    Can you post it as an answer…

    In short, no, it will not.

    The function in your testscenario gets executed three times.Now considering SQL Server’s DateTime datatype ony being accurate to Rounded increments of .000, .003, or .007 seconds, you can get different results between calls. The only reason you don’t see them in your testscenario is because all calls return within the same time interval.

    Proof of concept

    Following script might take a while to execute but it will stop when the three seperate calls don’t occur within the same interval.

    SET NOCOUNT ON 
    DECLARE @Var INTEGER = 1 
    WHILE @Var = 1 
    BEGIN 
      SELECT @Var = COUNT(*) 
      WHERE  dbo.GetMyDate() BETWEEN dbo.GetMyDate() AND dbo.GetMyDate()   
    
      SELECT @Var 
    END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to write an Oracle procedure which should invoke an Oracle function returning
I have a custom PHP function which executes a stored procedure and returns an
I have a Function called dbo.GetFoo(). I also have a unit-testing Stored Procedure called
I have a stored procedure that is returning a few fields, most containing some
I have a stored procedure which is returning me about 50 columns. I want
Assume I have some stored procedure (and I can't change it) which is returning
I have a stored procedure that needs to return something from one of two
I have this store procedure... select a.IsDirectClient from dbo.Companies as a where a.SchemeName =
I have written a Stored procedure which return some fields from a temporary table
I have the following Stored Procedure ALTER PROCEDURE [dbo].[bt_BizForSale_GetByID] ( @ID int ) AS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.