Questions tagged [smalldatetime]
59 questions
1
vote
3 answers
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
I am trying to convert a string which is in the format " 01/02/2018 02:48:04 PM " to a smalldatetime format to insert into MS SQL.
import java.sql.Date;
import java.sql.Timestamp;
import java.time.Instant;
import java.time.LocalDate;
import…

Sai Haridass
- 344
- 2
- 11
1
vote
2 answers
30 second offset with smalldatetime comparison on SQL
I've came across an odd problem while comparing dates (actually smalldatetime) in SQL Server. It seems like there is a 30 seconds offset/bias while comparing dates close to the end of the day:
This is correct:
But this is definitely not…

Pedro Henrique
- 680
- 7
- 22
1
vote
1 answer
JDBC encoding to sql server smalldatetime
I'm trying to execute a stored proc where one of the parameters is of type smalldatetime. In the past I've always encoded datetime2 and datetime fields as strings and that worked fine. I'm using the Microsoft JDBC Driver
I am getting this error…

Danny G
- 581
- 4
- 16
1
vote
2 answers
Convert datetime to smalldatetime in sql insert query
I have an INSERT query like this
INSERT INTO tna_temp_attendance VALUES('" + strEmpCode + "', CONVERT(SMALLDATETIME, '" + dtDateTime.ToString() + "'), 0, " + _inOutMode.ToString() + ", null, 0, 'CHO-', '" + strMachine + "')
When I execute this…

Kelum Srimal
- 159
- 1
- 3
- 17
1
vote
2 answers
Cast different parts of a varchar into a date time, SQL
I have a varchar that is an 8 digit number and I need to convert to a datetime. The production number is an automatically generated number from when the time the order was placed. For example, the production number 10090203 is actually the datetime…

Cheddar
- 530
- 4
- 30
1
vote
1 answer
Very Strange SqlClient error with SmallDatetime parameter in SQL Server 2014 stored proc
I've been stumped with the following error for the past hour:
"Procedure or function 'write_call' expects parameter '@Date', which was not supplied."
The @date parameter is a smalldatetime. I am trying to pass the value #1/27/2009 04:32:00 PM#
I am…

Charles Okwuagwu
- 10,538
- 16
- 87
- 157
1
vote
1 answer
Move smalldatetime from databound DGV to new form textbox and change format
I am currently working in windows form application in visual studio express for desktop. I also have an sql back end. I am trying to pull a smalldatetime from a DGV that has been loaded from an SQL table and then move it into a textbox on a new…

Cheddar
- 530
- 4
- 30
1
vote
1 answer
Datetime format doesn't do what is supposed to do
So I have a datetime column that I want to convert to a smalldatetime on my report. What I am expecting is something like:
2011-07-13 09:51:21.087 to 2011-07-13 09:51:21
Simple right? Well the datetime column is returning a T instead of a space so…

user2280319
- 15
- 3
1
vote
1 answer
Vb select using dates
This is my code, i want to select data from a database that is between two dates:
Dim Sql As String = "Select strCodSeccao,strAbrevTpDoc,strCodExercicio,strNumero From Mov_Venda_Cab where dtmdate between " & date1 & " and " & date2 &…

Esteves
- 35
- 8
1
vote
2 answers
Handling Dates while copying from Excel to SQL server database table in Talend
I am copying data from an Excel workbook to the SQL server database table.
One of the column in my Excel sheet has Dates, which I am generating using Rand function.
If I keep data types of my columns as string in both my Excel input and SQL…

Quick-gun Morgan
- 338
- 12
- 31
1
vote
2 answers
Datatable select time in smalldatetime column
I have a datatable with 4 columns and one of them is smalldatetime type. When I retrieve datatable from SQL base, I would like to query further through datatable, but only by a specific time. Is this possible?
I am tryin with something like…

miller
- 1,636
- 3
- 26
- 55
0
votes
1 answer
SmallDateTime In SQL Server
How can I retrieve only the TIME in the SmallDateTime datatype in SQL using SELECT Command?

Minima
- 133
- 1
- 4
- 13
0
votes
0 answers
No date/time in Select statement, getting: Conversion failed when converting character string to smalldatetime data type
I have the following select statement
SELECT Distinct lastname, firstname, UserName, r.name as 'Role', ug.name AS 'UserGroup'
and the following where statement
where userid = 894 and (EndDate > '2022-05-11 00:00:00' or endDate = 'NULL')
Getting…

MDL
- 1
0
votes
2 answers
select smalldatetime between two strings
DROP TABLE IF EXISTS b;
CREATE TABLE b(
MajDate smalldatetime
);
INSERT INTO b(MajDate) VALUES
(try_convert(smalldatetime,'2016-11-30 11:23:00')),
(try_convert(smalldatetime,'2021-07-07 11:07:00')),
(try_convert(smalldatetime,'2021-07-07…

Ludovic Aubert
- 9,534
- 4
- 16
- 28
0
votes
0 answers
Assigning 31.12.2099 to an OLE DB parameter of type DBTimeStamp doesnt work after changing to MSOLEDBSQL
To use the "OLE DB Driver for SQL Server" I changed the provider in the connection string from Provider=SQLOLEDB.1 to Provider=MSOLEDBSQL as it should be. Now I'm getting the error "Invalid date format" if I assign the date 31.12.2099 to an OLE DB…

Mustafa Alamir
- 1
- 2