I have a stored procedure that gets data from a database that utilizes a column with type datetime (there is a valid time value in it) and it updates a table in another database that happens to use the smalldatetime type. When trying to convert from the datetime type to the smalldatetime type, I'm losing the time portion of the date. For some strange reason the date is being rounded up by a day on me. Is there some sort of special convert statement from datetime to smalldatetime that preserves the time portion of that date value?
Convert datetime to smalldatetime in SQL stored procedure that preserves the time?
311 Views Asked by CurlyShuffle At
1
There are 1 best solutions below
Related Questions in SQL
- SQL schema for a fill-in-the-blank exercise
- Hibernate: JOIN inheritance question - why the need for two left joins
- What's supposed to be the problem in this query?
- Compare fields in two tables
- How to change woocomerce or full wordpress currency with value from USD to AUD
- Dynamic query creation with Array like implementation
- SQL query to get student enrolled in this month in a course - Moodle
- SQL LAG() function returning 0 for every row despite available previous rows
- Convert C# DateTime.Ticks to Bigquery DateTime Format
- Use row values from another table to select them as columns and establish relations between them (pivot table)
- SQL: Generate combination table based on source and destination column from same table
- how to use system's environnement variables in sql script
- PHP fetchAll on JOIN
- Multitable joining in Sql
- How to display name starting from 'z' by using BETWEEN cmd only?
Related Questions in DATETIME
- I wrote this time displaying FLUTTER app, How can I improve it?
- How to convert pandas series to integer for use in datetime.fromisocalendar
- JSON file of 7000 meetings in multiple timezones and Flatlist
- Intl.DateTimeFormat() - return weekday as number?
- I'd like to create a custom time zone converter, any pointers?
- How set weekday datetime?
- ValueError: setting an array element with a sequence. Trying to make a Skymap in Python
- Different X axes with Plotly's make_subplots
- Error when converting datetime from UTC to Brasilia datetime in Power BI
- Problem converting time series df from chr to date using as.POSIXct
- How to supress naive datetime warning in django
- How to find rows that fall within time range from a dataframe?
- Timedelta error - AttributeError: type object 'datetime.datetime' has no attribute 'timedelta'
- How to convert "Tue Feb 27 2024 16:35:30 GMT+0800" String to ZonedDateTime type
- react apex charts x axis labels and tool tip showing different times instead of actual PST time
Related Questions in SMALLDATETIME
- ASP.NET vb.net "The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value."
- No date/time in Select statement, getting: Conversion failed when converting character string to smalldatetime data type
- select smalldatetime between two strings
- Assigning 31.12.2099 to an OLE DB parameter of type DBTimeStamp doesnt work after changing to MSOLEDBSQL
- T-sql SmallDateTime add day when time passed 23:30
- Trigger date conversion fails
- Return extra ".0" when reading "smalldatetime" column with PreparedStatement
- Getting Date Range
- How to convert "01/30/2018 02:29:23 PM" into smalldatetime format? I am using MSSQL for my application and the column is smalldatetime format
- SQL Server 2008 : issues with date conversion
- Convert datetime to smalldatetime in SQL stored procedure that preserves the time?
- MSSQL PreparedStatement for smalldatetime returns wrong result
- How to insert smalldatetime
- 30 second offset with smalldatetime comparison on SQL
- Convert timestamp (int) to smalldatetime (t-sql)
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Apparently after digging around more I found the answer to my question. The smalldatetime data type rounds the seconds. If it's :29 and below, it goes to the previous minute. If it's :30 and above, it goes to the next minute. I wasn't aware of this previously. What's really goofy is that you still see the seconds value in the database even though it's always :00.