Questions tagged [smalldatetime]

59 questions
0
votes
1 answer

SQL Server : order of operations not being followed?

[Running SQL Server 2008 SP3] I have a query which results in the overflow of a smalldatetime type. However, this should (in theory) never happen, due to the way I have the query structured - the logic should cause the truth value to be known long…
Conrad
  • 2,197
  • 28
  • 53
0
votes
1 answer

select smalldatetime between two smalldatetimes in another table

i need to select ( small date time) from ( date ) user will enters like table have 2013-07-05 09:12:00 2014-07-03 10:12:00 2014-07-04 13:32:00 2014-07-08 14:30:00 2014-07-06 08:27:00 named times when user enter date from calender it convert to…
didodido
  • 263
  • 1
  • 3
  • 7
0
votes
2 answers

How to compare smalldatetime in stored procedure

I'm writing stored procedure to compare dates but it's not working properly. How can I make it so it compares only the dates but not the time? What I'm trying to do is compare the times and if the Id is null than insert a new entry with the same…
user2994144
  • 177
  • 1
  • 1
  • 11
0
votes
2 answers

SQL Server 2005: converting smalldatetime to varchar behaves differently in view and 'normal' query

I have a view that basically just returns all records from a table, and adds a column 'isodate' which is supposed to be the date in ISO-Format. CREATE VIEW [dbo].[v_bedarfe] AS SELECT *,convert(varchar(16),datum,20) As isodat FROM…
MBaas
  • 7,248
  • 6
  • 44
  • 61
0
votes
1 answer

Compare Months list with date field of table

I am using sql server 2008 I have table in my database is like this: And I want output like this: As it is shown in my table I have DateField which has smalldatetime datatype and along with fruits and vegi fields. I want output like which shows…
IT_INFOhUb
  • 516
  • 8
  • 21
  • 40
0
votes
4 answers

Cast int to SmallDateTime

I am trying to compare L.LoanDueDate (which is a smalldatetime) to the return value of ufnARCUGetLatestProcessDate() (which is an int) to see how many days the loan due date is past the last process date. I receive an Arithmetic overflow error…
JoBaxter
  • 710
  • 2
  • 12
  • 23
0
votes
1 answer

How to compare just the date, not the timestamp using LINQ

I'm trying to compare just the date of a column but because the query below is also comparing the time I get no result set back. How could I write this same LINQ query if I'm only interested in the actual date value matching? The column "ImportDate"…
Toran Billups
  • 27,111
  • 40
  • 155
  • 268
0
votes
2 answers

Adding the DateUploaded Time to MS SQL Database from PHP

After looking into it for a while I am struggling to use a hidden form field and a PHP MS SQL Query to add the date uploaded to the database when the data is submitted. Something similar to the MySQL NOW() function. Which I have tried and doesn't…
Bohdi
  • 1,295
  • 4
  • 28
  • 62
0
votes
1 answer

SQL query w/ ISNULL won't output smalldatetime to 101 format

Snippet from a SQL query (using SQL Server 2008 R2): , CONVERT (VARCHAR(10), s.ENTER_DATE, 101) "Enrollment Start Date" , CONVERT (VARCHAR(10), (ISNULL(CAST(s.LEAVE_DATE AS VARCHAR(10)), '')) ,101) "Enrollment Drop Date" The top line works fine to…
24601
  • 23
  • 1
  • 4
0
votes
2 answers

Unable to inject smalldatetime into D-SQL statement

when i try to execute this sql statement i am getting the error.. Conversion failed when converting character string to smalldatetime data type. Does anyone know what i am doing wrong? declare @modality varchar(50) declare @datefrom…
Grant
0
votes
2 answers

Sql Server Query Date Issue

This executes correctly: (It is weird that I needed to use '' by the date for it to actually execute) DECLARE @cols AS NVARCHAR(MAX), @query AS NVARCHAR(MAX); select @cols = STUFF((SELECT distinct ',' + QUOTENAME(c.statcolumnname) FROM…
Thomas
  • 342
  • 11
  • 29
0
votes
2 answers

Most efficient way to store only the date?

DateTime is accurate to three-hundredths of a second. SmallDateTime is accurate to one minute. What if you only need accuracy to a day? What is the best practice here? I realise that a DateTime is 8 bytes, and SmallDateTime is only 4; but I am…
Simon Kiely
  • 5,880
  • 28
  • 94
  • 180
-1
votes
3 answers

T-sql SmallDateTime add day when time passed 23:30

T-sql SmallDateTime add day when time passed 23:30 declare @sampledate DateTime set @sampledate='2020-09-18 23:59:53' select @sampledate AS Date, CAST(@sampledate as DATE) AS CAST_Date, CAST(@sampledate as SmallDateTime)…
Chetan
  • 1
-2
votes
1 answer

Getting Date Range

I want to get all the information between two given dates, How can I get a range of Date in SQL server with the datatype of "smalldatetime" I'm expecting to get all the information start from start date to end date
1 2 3
4