Questions tagged [smalldatetime]
59 questions
49
votes
4 answers
How to select data from 30 days?
I have query:
SELECT name
FROM (
SELECT name FROM
Hist_answer
WHERE id_city='34324' AND datetime >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH)
UNION ALL
SELECT name FROM
Hist_internet
WHERE id_city='34324' AND datetime >= DATE_SUB(CURRENT_DATE,…

Alex N
- 1,111
- 4
- 13
- 20
40
votes
2 answers
check for null date in CASE statement, where have I gone wrong?
My source table looks like this
Id StartDate
1 (null)
2 12/12/2009
3 10/10/2009
I want to create a select statement, that selects the above, but also has an additional column to display a varchar if the date is not null such as :…

Jimmy
- 16,123
- 39
- 133
- 213
5
votes
2 answers
How do I format dd-mmm-yy values in flat file to smalldatetime during data import?
I have a flat file which is imported into SQL Server via an existing SSIS package. I need to make a change to the package to accommodate a new field in the flat file. The new field is a date field which is in the format dd-mmm-yy (e.g. 25-AUG-11).…

Adrian S
- 1,007
- 4
- 12
- 26
5
votes
3 answers
datetime vs smalldatetime
If I don't care about less than seconds, what should be the recommended type to store my datetime values in sql-server 2005, is it datetime or smalldatetime or else?

Shimmy Weitzhandler
- 101,809
- 122
- 424
- 632
4
votes
2 answers
SQL Server smalldatetime vs datetime2
I've read several articles about using data types that support dates in SQL Server but I'm still undecided about what kind of data to use.
All the people says to use the new and powerful datetime2 type but smalldatetime is still more convenient in…

Oscar Peli
- 1,108
- 2
- 11
- 18
3
votes
3 answers
Convert varchar column to smalldatetime
I have a table with 800+ records. In this table I have a column named 'Data' of varchar(10) datatype which contains dates in dd.MM.yyyy format.I want to convert it to smalldatetime.
I've tried converting it using Enterprise Management Studio…

milo2010
- 91
- 1
- 2
- 5
3
votes
3 answers
How do I convert an SQL Server SMALLDATETIME to a Unix timestamp?
How do I convert an SQL Server SMALLDATETIME to Unix Timestamp?
date was stored as CAST(0x96040474 AS SmallDateTime) in MS Access DB. Data was dumped to SQL and I'm looking to convert those times to Unix Timestamps for MySQL.
Thanks
AO
Agent Ogden
3
votes
4 answers
conversion of a varchar to a smalldatetime results in an out-of-range value
The code:
strSql = "insert into table2 (transactiondate) values ('" & transactiondate & "')"
seems to be giving me the runtime error:
The conversion of a varchar data type to a smalldatetime data type resulted in an out-of-range value
In the code,…
michael
2
votes
4 answers
ASP.NET to SQL Server 2005, UPDATE smalldatetime procedure doesn't work?
As the topic suggests. I'm making a small program where you can browse and handle a bunch of data. The problem is that while inserting new rows into the SQL table works fine, using the same methods to update causes a problem with the smalldatetime…

Zan
- 317
- 4
- 8
- 17
2
votes
6 answers
C# inserting datetime failure
I've got a database with a table called Fio_FinalSched which in turn has a column named FinalDate with type smalldatetime. I convert the date string to a DateTime type by:
DateTime theDate = Convert.ToDateTime("2010-01-05 23:50:00");
I then create…

hemlocker
- 1,012
- 1
- 9
- 24
2
votes
1 answer
MSSQL PreparedStatement for smalldatetime returns wrong result
I have a table in my mssql database with one of the column as smalldatetime datatype.
smalldatetime datatype does not have seconds precision. As per its documentation:
ss is two digits, ranging from 00 to 59, that represent the second. Values that…

Eshita Mathur
- 43
- 1
- 1
- 7
2
votes
4 answers
SQL Server 2014 insert/update smalldatetime value with seconds
I'm having a strange issue with the smalldatetime data type in SQL Server.
I have a very basic table
create table datetest (
value smalldatetime not null
)
And when I run the following
insert into datetest
values ('2016-12-29 21:30:00');
I…

TheLovelySausage
- 3,838
- 15
- 56
- 106
2
votes
1 answer
FluentNHibernate mapping smalldatetime SQL data type
I have a legacy database that uses the smalldatetime SQL data type. That maps fine to the standard DateTime. However, when I use SchemaExport, it understandably generates the column with datetime format. What custom type should I be using in my…

Ted
- 7,122
- 9
- 50
- 76
2
votes
3 answers
SQL Server programming - update all dates by a given number of days
I have a demo database with a couple of hundred tables in it. Each table usually has at least one field named tstamp which is a smalldatetime datatype. Some tables have other datefields too. Many tables also have 1 or more triggers on them.
I wrote…
Joe
1
vote
1 answer
SQL Server : error converting string to smalldatetime?
Can anyone help me with the following extract of code I have put together. The error appears to be in the CASE statement but I'm unable to see where as all the code parts after THEN have been tested individually and work.
Also to note that all dates…

LinkOps
- 331
- 3
- 14